Skip to content

Add DatabaseDialect and implement identifiers truncation#54

Open
martinv13 wants to merge 4 commits intocre-dev:mainfrom
martinv13:feature/add_db_dialects
Open

Add DatabaseDialect and implement identifiers truncation#54
martinv13 wants to merge 4 commits intocre-dev:mainfrom
martinv13:feature/add_db_dialects

Conversation

@martinv13
Copy link
Copy Markdown
Collaborator

Two related problems motivated this refactor:

  • Backend-specific logic was scattered across 6 files as if db_type == "..." conditionals, making it hard to maintain.
  • PostgreSQL limits identifiers to 63 characters, which caused errors with longer XSD element names.

Changes:

  • Added a DatabaseDialect class hierarchy (base, postgresql, mssql, mysql, duckdb), one subclass per backend.
  • Migrated all db_type conditionals into the appropriate dialect class.
  • db_identifier() in the base class now truncates names exceeding MAX_IDENTIFIER_LENGTH using a stable MD5 hash suffix. Each dialect sets its own limit.
  • SQLAlchemy's key/name duality on Column is used to keep logical names stable in Python while sending truncated physical names to the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant