feat: IbisBackend as single handle — settings-aware constructor + operations + lifecycle#80
Merged
Merged
Conversation
…lidation Add _SCHEME_TO_DIALECT map, three-way dispatch (settings, URL, dialect), empty-list normalization in connect(), and URL-direct via ibis.connect(). Error cases tested: no args, both args, unknown scheme. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…arameters support Extend IbisBackend constructor to accept three input forms: - SettingsParameters (positional) — resolves via descriptor.ibis_dialect + to_driver_kwargs() - Connection URL (positional) — detects dialect from scheme, delegates to ibis.connect() - dialect= keyword + **config — existing path, unchanged Adds _SCHEME_TO_DIALECT reverse lookup, empty-list normalization in connect(), and 8 new tests covering settings, URL, and error paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pec/plan Old spec bundled to_relation() which has been descoped per revised principle. New spec focuses solely on settings-aware IbisBackend constructor (Phase 1 of connection consolidation). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #80 +/- ##
===========================================
- Coverage 55.82% 50.35% -5.48%
===========================================
Files 51 43 -8
Lines 2556 1855 -701
Branches 270 259 -11
===========================================
- Hits 1427 934 -493
+ Misses 1021 813 -208
Partials 108 108 ☔ View full report in Codecov by Sentry. |
Collapses connection consolidation Phases 2+3 into a single phase: make IbisBackend the single public handle for all ibis interaction by absorbing operations via DialectSpec hooks, adding fluent API, and deleting factories/DatabaseUtils/legacy class hierarchies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…le spec - Keep core/connection.py (BaseDBConnection) — Iceberg depends on it - Document Redshift URL ambiguity and resolution - Add explicit compatibility section (internal package, no deprecation needed) - Add out-of-scope section for Iceberg migration and future dialect hooks Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7 tasks: protocol+lifecycle, DialectSpec hooks, operations on backend, IcebergBackend update, delete legacy code, rewrite tests, validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…o IbisBackend connect() and close() return self for fluent chaining. Context manager support via __enter__/__exit__. Inspection methods delegate to internal IbisConnection. Backend protocol updated: connect() returns Self, Connection protocol removed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add upsert_hook, create_index_hook, drop_index_hook, rename_table_hook to DialectSpec. Extract standalone hook functions from _DuckDBFamilyOperationsMixin. Wire DuckDB/SQLite/MotherDuck entries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fluent methods (create_table, insert, upsert, create_index, etc.) return self. Terminal methods (table, run_sql, list_indexes, etc.) return data. Hook dispatch: upsert/index operations via DialectSpec callables. One deviation from spec: truncate() omits the schema kwarg when calling ibis truncate_table() because SQLBackend does not accept it at the base level; schema is preserved in the method signature for future dialects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
connect() returns self, context manager support, inspection methods delegate to internal connection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…archies Remove ConnectionFactory, OperationsFactory, SettingsFactory, DatabaseUtils, BaseIbisConnection + 12 subclasses, BaseIbisOperations + concrete subclasses. Keep BaseDBConnection (Iceberg depends on it). Update __init__.py to export only Backend, IbisBackend, IcebergBackend, and inspection model. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Delete factory tests, DatabaseUtils tests, legacy connection tests, and legacy operations tests. Rewrite integration tests and settings parametrized tests to use IbisBackend directly. Update package structure tests to verify removed exports are gone. Co-Authored-By: Claude Sonnet 4.6 <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.



Summary
IbisBackendsettings-aware — acceptSettingsParameters, URLs, and dialect keywords via three-way constructor dispatchIbisBackendthe single public handle for all ibis interaction — lifecycle management, fluent operations API, and hook-dispatched per-dialect operations viaDialectSpecConnectionFactory,OperationsFactory,SettingsFactory,DatabaseUtils,BaseIbisConnection+ 12 subclasses,BaseIbisOperations+ concrete subclassesIbisBackenddirectlyWhat Changed
New capabilities on
IbisBackendconnect()/close()returnself(fluent)with IbisBackend(...) as backend:create_table,drop_table,insert,truncate,create_view,drop_viewupsert,create_index,drop_index,index_exists,list_indexesibis_connection()(raw ibis),get_connection()(internal wrapper)list_tables,inspect_table,inspect_catalog, etc.DialectSpec expansion
upsert_hook,create_index_hook,drop_index_hook,rename_table_hookDeleted
core/factories/(entire directory)core/utils.py(DatabaseUtils)backends/ibis/connection.py(BaseIbisConnection + 12 subclasses)BaseIbisOperationsclass hierarchy fromoperations.pyConnectionprotocol fromprotocol.pyKept
core/connection.py(BaseDBConnection — Iceberg depends on it)Test plan
🤖 Generated with Claude Code