base
etl_craft.dialects.engine.base ¶
What differs between Engine DBs, behind one interface.
Each dialect is a directory holding its module, its schema.sql (what init-db applies to
an empty database), its migrations/ (what migrate applies to an existing one) and its
queries/. Callers never branch on the Engine DB themselves: they ask for the dialect and
call the method they need.
The query catalog holds every Engine DB query as a .sql file named after the query. A
dialect's own queries/<name>.sql overrides the shared dialects/engine/queries/<name>.sql
where the SQL differs. Every selected column is aliased in lower case, because SQLite and
PostgreSQL disagree on the case of unquoted identifiers.
EngineDialect ¶
Bases: ABC
One Engine DB: how to connect, lock, split scripts, and which SQL to run.
build_engine
abstractmethod
¶
Build a SQLAlchemy engine for profile, with no secret in its URL.
lock
abstractmethod
¶
Hold the cross-process lock key for the with body.
name identifies it in messages. With wait_seconds 0 it waits indefinitely;
otherwise it raises LockTimeoutError once that time has passed.
refresh_metadata_triggers
abstractmethod
¶
Install metadata capture and write guards for the current table definitions.
schema_problem ¶
Return why the Engine schema cannot be used, or None.
SQLite has one schema per file, and the file is created on first connect.
migrations_dir ¶
Return the directory of the packaged ENGINE migration stream.
split_statements ¶
Split a script into statements this database accepts one at a time.
migration_transaction ¶
migration_transaction(engine: Engine, *, rebuild_metadata: str | None = None) -> Iterator[Connection]
Apply a migration and its ledger row together, including any dialect's rebuild setup.
queries_dir ¶
Return this dialect's own queries directory; its files override shared ones.
query_path ¶
Return the file query name is read from; LookupError for an unknown name.
query ¶
Return the SQL text of query name.
Whole-line -- comments describe the query in its file and are left out, so a
comment may name a :parameter without the driver seeing a second one.
existing_tables ¶
Return which of names already exist as tables, in lower case and sorted.