Rewrite SQLAlchemy dialect to support IoTDB 2.0+ table model#17537
Open
JackieTien97 wants to merge 3 commits intomasterfrom
Open
Rewrite SQLAlchemy dialect to support IoTDB 2.0+ table model#17537JackieTien97 wants to merge 3 commits intomasterfrom
JackieTien97 wants to merge 3 commits intomasterfrom
Conversation
The old SQLAlchemy dialect was built for the tree model (path-based schema). This rewrites it to support the table model with standard relational SQL, including: - Column categories (TAG, ATTRIBUTE, FIELD, TIME) via dialect-specific args - DDL generation with CREATE TABLE categories and TTL support - Table model reflection (SHOW TABLES, SHOW COLUMNS FROM) - Updated type mappings (STRING, BLOB, TIMESTAMP, DATE) - Simplified SQL compiler (table model supports standard SQL) - DBAPI layer: add sql_dialect parameter, propagate exceptions Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17537 +/- ##
============================================
- Coverage 39.86% 39.80% -0.06%
Complexity 312 312
============================================
Files 5137 5142 +5
Lines 347310 347862 +552
Branches 44268 44397 +129
============================================
+ Hits 138444 138475 +31
- Misses 208866 209387 +521 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add sqlalchemy_example.py covering DDL/DML/reflection/raw SQL - Add README_ZH.md as full Chinese translation of README.md - Update README.md SQLAlchemy section for IoTDB 2.0+ table model - Add tests for all data types, advanced queries (aggregation, AND/OR, NULL, batch insert, LIMIT+OFFSET), schema operations (has_schema, has_table, multiple databases, column category reflection, get_view_names), raw SQL, and URL-with-database
|
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
Rewrite the Python SQLAlchemy dialect to support the IoTDB 2.0+ table model, replacing the old tree-model dialect.
Changes
sql_dialectanddatabaseparameters toConnection; remove silent exception swallowing inCursor.execute()SHOW TABLES,SHOW COLUMNS FROM),construct_argumentsfor column categories and TTLCREATE TABLEwith TAG/ATTRIBUTE/FIELD/TIME column categories andWITH (TTL=...)clauseUsage
Column Categories
Columns are categorized via
iotdb_categorydialect argument:TAG— indexed identity columnsATTRIBUTE— metadata columns (not indexed)FIELD— measurement/value columnsTIME— explicit time column (optional; auto-generated if omitted)