Add ibis_extras package with SingleStoreDB Ibis backend extensions#120
Open
Add ibis_extras package with SingleStoreDB Ibis backend extensions#120
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 <noreply@anthropic.com>
There was a problem hiding this comment.
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 <175728472+Copilot@users.noreply.github.com>
- 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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.