-
Notifications
You must be signed in to change notification settings - Fork 22
Add ibis_extras package with SingleStoreDB Ibis backend extensions #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add mixin classes that extend the Ibis SingleStoreDB backend and ir.Table with SingleStoreDB-specific functionality: - BackendExtensionsMixin: variable/show accessors (globals, locals, cluster_globals, cluster_locals, vars, cluster_vars, show), plus get_storage_info(), get_workload_metrics(), optimize_table(), and get_table_stats() methods - TableExtensionsMixin: optimize(), get_stats(), and get_column_statistics() methods for SingleStoreDB tables The mixins are automatically registered on import via dynamic base class injection. Protocol classes are used for type checking to satisfy mypy while keeping runtime behavior unchanged. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new ibis_extras package that extends the Ibis SingleStoreDB backend with SingleStoreDB-specific functionality through mixin classes that are automatically injected into the backend and table classes at import time.
Changes:
- Adds
BackendExtensionsMixinwith variable/show accessors and new methods for storage info, workload metrics, table optimization, and statistics - Adds
TableExtensionsMixinwith table-specific methods for optimization, statistics, and column statistics - Implements automatic mixin registration via dynamic base class modification
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| singlestoredb/ibis_extras/mixins.py | Defines mixin classes with SingleStoreDB-specific extensions for backend and table operations, including SQL helper functions for identifier quoting and string escaping |
| singlestoredb/ibis_extras/init.py | Implements automatic registration mechanism that modifies base classes at import time, with collision detection for existing methods/properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
- Add error handling for optional ibis imports with informative message - Remove sqlglot dependency, use backtick quoting for identifiers - Fix database context assumption in table methods by extracting database from table's namespace metadata - Table methods now correctly pass database to backend methods Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update _get_table_backend_and_db() to always return resolved database
name with optional escape parameter ('identifier', 'literal', or None)
- Move optimize_table() implementation to TableExtensionsMixin.optimize()
- Move get_table_stats() implementation to TableExtensionsMixin.get_stats()
- Simplify get_column_statistics() to use new escape parameter
- Remove optimize_table() and get_table_stats() from BackendExtensionsMixin
- Update __init__.py docstring to remove backend method reference
Co-Authored-By: Claude Opus 4.5 <[email protected]>
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 <[email protected]>
Add mixin classes that extend the Ibis SingleStoreDB backend and ir.Table with SingleStoreDB-specific functionality:
BackendExtensionsMixin: variable/show accessors (globals, locals, cluster_globals, cluster_locals, vars, cluster_vars, show), plus get_storage_info(), get_workload_metrics(), optimize_table(), and get_table_stats() methods
TableExtensionsMixin: optimize(), get_stats(), and get_column_statistics() methods for SingleStoreDB tables
The mixins are automatically registered on import via dynamic base class injection. Protocol classes are used for type checking to satisfy mypy while keeping runtime behavior unchanged.