Skip to content

Commit 0314f27

Browse files
Return df to keep consistency
1 parent ec6ee77 commit 0314f27

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

mindsdb_sdk/connectors/rest_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def objects_tree(self, item='', with_schemas=False):
136136
r = self.session.get(self.url + f'/api/tree/{item}', params=params)
137137
_raise_for_status(r)
138138

139-
return r.json() # Return raw JSON instead of DataFrame for more flexible processing
139+
return pd.DataFrame(r.json())
140140

141141
@staticmethod
142142
def read_file_as_bytes(file_path: str):

mindsdb_sdk/databases.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ def tree(self, with_schemas: bool = False) -> List[TreeNode]:
8080
... else:
8181
... print(f"Table: {item.name}, Type: {item.type}")
8282
"""
83-
tree_data = self.api.objects_tree(self.name, with_schemas=with_schemas)
84-
return [TreeNode.from_dict(item) for item in tree_data]
83+
df = self.api.objects_tree(self.name, with_schemas=with_schemas)
84+
return [TreeNode.from_dict(row.to_dict()) for _, row in df.iterrows()]
8585

8686

8787
class Databases(CollectionBase):

mindsdb_sdk/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def tree(self) -> List[TreeNode]:
8282
>>> for db in tree:
8383
... print(f"Database: {db.name}, Type: {db.type}, Engine: {db.engine}")
8484
"""
85-
tree_data = self.api.objects_tree('')
86-
return [TreeNode.from_dict(item) for item in tree_data]
85+
df = self.api.objects_tree('')
86+
return [TreeNode.from_dict(row.to_dict()) for _, row in df.iterrows()]
8787

8888
def __repr__(self):
8989
return f'{self.__class__.__name__}({self.api.url})'

0 commit comments

Comments
 (0)