Skip to content

Commit 0cd7d52

Browse files
kesmit13claude
andcommitted
Change get_stats() to return ir.Table for consistency
Return ir.Table instead of dict to match get_storage_info() and get_column_statistics(). This provides lazy evaluation and lets users work with the data however they prefer. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 96d9f47 commit 0cd7d52

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

singlestoredb/ibis_extras/mixins.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,17 @@ def optimize(self) -> None:
163163
with backend.raw_sql(f'OPTIMIZE TABLE {db}.{table} FULL'):
164164
pass
165165

166-
def get_stats(self) -> dict[str, Any]:
166+
def get_stats(self) -> ir.Table:
167167
"""Get statistics for this table (SingleStoreDB only)."""
168168
backend, db = _get_table_backend_and_db(self, escape='literal')
169169
table = _escape_string_literal(self.get_name())
170170
# S608: db and table are escaped via _escape_string_literal
171-
result = backend.sql(
171+
return backend.sql(
172172
f"""
173173
SELECT * FROM information_schema.table_statistics
174174
WHERE database_name = '{db}' AND table_name = '{table}'
175175
""", # noqa: S608
176-
).execute()
177-
return result.to_dict(orient='records')[0] if len(result) else {}
176+
)
178177

179178
def get_column_statistics(self, column: str | None = None) -> ir.Table:
180179
"""Get column statistics (SingleStoreDB only).

0 commit comments

Comments
 (0)