Python API inventory¶
This inventory covers declared package exports, configuration, and runtime handles. Signatures and declared fields come from the current source. Internal engine exports are contributor interfaces, not a compatibility promise. Use the plugin development guide when choosing extension points.
For usage, see configuration, models, plugin hooks, and the backend guides.
Regenerate this inventory with python scripts/check-docs.py --api-reference.
dbwarden¶
database_config¶
database_config(*, database_name: 'str', database_type: 'DatabaseType' = 'sqlite', database_url_sync: 'str | None' = None, database_url_async: 'str | None' = None, secure_values: 'bool' = False, skip_if_missing: 'bool' = False, default: 'bool' = False, migrations_dir: 'str | None' = None, migration_table: 'str | None' = None, model_paths: 'list[str] | None' = None, model_tables: 'list[str] | None' = None, data_paths: 'list[str] | None' = None, data_snapshot_dir: 'str' = '.dbwarden/data', snapshot_registry: 'str' = '.dbwarden/snapshots/registry.json', dev_database_type: 'DatabaseType | None' = None, dev_database_url: 'str | None' = None, overlap_models: 'bool' = False, auto_apply_seeds: 'bool' = False, seed_table: 'str | None' = None, pg_schema: 'str | None' = None, pg_migration_lock_timeout: 'int | None' = None, ch_cluster: 'str | None' = None, ch_replicated_database: 'bool' = False, clickhouse_lock_ttl: 'int | None' = None, lock_namespace: 'str | None' = None, migration_hooks: 'dict[str, list[Callable[..., Any]]] | None' = None, environments: 'list[Any] | None' = None, split_at_severity: 'str | None' = None, max_severity: 'str' = 'CRITICAL', strict_pending: 'bool' = False, **plugin_config: 'Any') -> 'DatabaseHandle'
EnvironmentConfig¶
Declared fields: name, url_env, persistent.
DbwardenConfig¶
DbwardenDatabase¶
ChEngineSpec¶
ChEngineSpec(name: 'str', args: 'tuple[str, ...]' = (), zookeeper_path: 'str | None' = None, replica_name: 'str | None' = None, settings: 'dict[str, str] | None' = None) -> None
Declared fields: name, args, zookeeper_path, replica_name, settings.
Methods declared on this class:
to_dict(self) -> 'dict[str, Any]'
from_dict(d: 'dict') -> 'ChEngineSpec'
from_engine_string(engine_str: 'str') -> 'ChEngineSpec'
CHTableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, ch_indexes, ch, ch_engine, ch_order_by, ch_primary_key, ch_partition_by, ch_sample_by, ch_ttl, ch_settings, ch_object_type, ch_select_statement, ch_to_table, ch_dictionary, ch_dict_layout, ch_dict_source, ch_dict_lifetime, ch_dict_primary_key, ch_projections, ch_zookeeper_path, ch_replica_name.
MyColumnMeta¶
Declared fields: comment, public, my.
MyTableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, my_engine, my_charset, my_collate, my_row_format, my_auto_increment, my_indexes, my_checks, my_uniques.
PGViewMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, pg_view_query, pg_view_materialized, pg_view_auto_refresh, pg_schema.
SqColumnMeta¶
Declared fields: comment, public, sq.
SqTableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, sq_without_rowid, sq_strict, sq_indexes.
load_plugins¶
register_migration_hooks¶
register_migration_hooks(*, pre_migration_run: 'list[Callable[..., Any]] | None' = None, pre_migration: 'list[Callable[..., Any]] | None' = None, migration_progress: 'list[Callable[..., Any]] | None' = None, post_migration: 'list[Callable[..., Any]] | None' = None, on_migration_failure: 'list[Callable[..., Any]] | None' = None, post_migration_run: 'list[Callable[..., Any]] | None' = None) -> 'None'
Seed¶
Declared fields: model, rows.
SeedRow¶
Declared fields: .
Methods declared on this class:
seed_data¶
seed_data(database: 'str', version: 'str' = '', description: 'str' = '', on_conflict: 'str' = 'ignore', conflict_columns: 'list[str] | None' = None)
dbwarden.cli¶
app¶
dbwarden.commands.make_migrations¶
RenameIntent¶
Declared fields: table, old_name, new_name.
auto_discover_model_paths¶
build_migration_plan¶
build_migration_plan(migration_id: str, changes: list[dbwarden.engine.migration_name.Change], upgrade_sql: str, *, typed_ops: list[dict] | None = None, content: str | None = None, backend: str = '') -> dict[str, object]
generate_migration_sql¶
generate_migration_sql(tables: list, migrations_dir: str | None = None, database: str | None = None, db_name: str | None = None, confirmed_renames: set[tuple[str, str, str]] | None = None, resolved_from_map: dict[tuple[str, str, str], str] | None = None, safe_type_change: bool = False, confirmed_table_intents: set[tuple[str, str]] | None = None, table_resolved_from_map: dict[tuple[str, str], str] | None = None, concurrent: bool = True, clickhouse_engine_recreate: bool = False, drop_preserved_clickhouse_table: bool | None = None, postgres_auto_using: bool = False) -> tuple[str, str, list[dbwarden.engine.migration_name.Change]]
get_all_model_tables¶
get_all_model_tables(model_paths: List[str] | None = None, db_name: str | None = None) -> List[dbwarden.engine.core.models.ModelTable]
get_current_model_state_path¶
get_database¶
get_model_state_path¶
get_pending_migration_statements¶
make_migrations_cmd¶
make_migrations_cmd(description: str | None = None, verbose: bool = False, database: str | None = None, output_plan: bool = False, output_sql: bool = False, rename_flags: list[str] | None = None, safe_type_change: bool = False, rename_table_flags: list[str] | None = None, concurrent: bool = True, offline: bool = False, migration_type: str = 'versioned', clickhouse_engine_recreate: bool = False, drop_preserved_clickhouse_table: bool | None = None, postgres_auto_using: bool = False, perf: bool = False, split_at_severity: str | None = None, strict_pending: bool | None = None, dry_run: bool = False, parameters: dict | None = None, show_managed_values: bool = False) -> None
new_migration_cmd¶
new_migration_cmd(description: str, version: str | None = None, database: str | None = None, migration_type: str = 'versioned') -> None
dbwarden.config_registry¶
register_reset_hook¶
reset_registry¶
registered_entries¶
registered_project_config¶
database_config¶
Re-export of dbwarden.config_registry.database_config.
DbwardenDatabase¶
Re-export of dbwarden.config_registry.DbwardenDatabase.
DbwardenConfig¶
Re-export of dbwarden.config_registry.DbwardenConfig.
dbwarden.config_schema¶
DatabaseEntry¶
DatabaseEntry(database_name: 'str', database_type: 'DatabaseType', database_url_sync: 'str | None' = None, database_url_async: 'str | None' = None, secure_values: 'bool' = False, skip_if_missing: 'bool' = False, default: 'bool' = False, migrations_dir: 'str | None' = None, migration_table: 'str | None' = None, model_paths: 'list[str] | None' = None, model_tables: 'list[str] | None' = None, data_paths: 'list[str]' = NOTHING, data_snapshot_dir: 'str' = '.dbwarden/data', snapshot_registry: 'str' = '.dbwarden/snapshots/registry.json', dev_database_type: 'DatabaseType | None' = None, dev_database_url: 'str | None' = None, overlap_models: 'bool' = False, auto_apply_seeds: 'bool' = False, seed_table: 'str | None' = None, pg_schema: 'str | None' = None, pg_migration_lock_timeout: 'int | None' = None, ch_cluster: 'str | None' = None, ch_replicated_database: 'bool' = False, clickhouse_lock_ttl: 'int | None' = None, lock_namespace: 'str | None' = None, recovery_policy: 'str' = 'halt', assume_session_pooling: 'bool' = False, tcp_keepalive: 'bool' = True, sqlite_busy_timeout: 'int | None' = None, per_statement_history: 'bool' = False, rename_policy: 'str' = 'prompt', split_at_severity: 'str | None' = None, max_severity: 'str' = 'CRITICAL', strict_pending: 'bool' = False, migration_hooks: 'dict[str, list] | None' = None, environments: 'list[Any] | None' = None, plugin_config: 'dict[str, Any]' = NOTHING) -> None
Declared fields: database_name, database_type, database_url_sync, database_url_async, secure_values, skip_if_missing, default, migrations_dir, migration_table, model_paths, model_tables, data_paths, data_snapshot_dir, snapshot_registry, dev_database_type, dev_database_url, overlap_models, auto_apply_seeds, seed_table, pg_schema, pg_migration_lock_timeout, ch_cluster, ch_replicated_database, clickhouse_lock_ttl, lock_namespace, recovery_policy, assume_session_pooling, tcp_keepalive, sqlite_busy_timeout, per_statement_history, rename_policy, split_at_severity, max_severity, strict_pending, migration_hooks, environments, plugin_config.
ProjectConfigEntry¶
ProjectConfigEntry(pre_migrate_safety: 'ProjectPolicy' = 'off', pre_migrate_impact: 'ProjectPolicy' = 'off', missing_plan: 'ProjectPolicy' = 'off', impact_paths: 'list[str]' = NOTHING) -> None
Declared fields: pre_migrate_safety, pre_migrate_impact, missing_plan, impact_paths.
MultiDatabaseConfig¶
Declared fields: default, databases.
structure_database_entry¶
structure_project_config¶
dbwarden.connection¶
get_db_connection¶
reset_connection_logging¶
QueryMethod¶
get_query¶
get_query(method: dbwarden.connection.queries.store.QueryMethod, db_name: str | None = None, **kwargs) -> str
dbwarden.data¶
ArchiveTable¶
Declared fields: table, schema.
DataMeta¶
DataTransition¶
aggregate¶
archive_table¶
batch¶
batch(*, size, key, max_duration=None, statement_timeout=None, lock_timeout=None, max_replication_lag=None)
case¶
cast¶
col¶
derive¶
derive(target, expression, *, rollback, when=None, on_unmatched='error', max_rows=None, category=None, settings=None, execution=None) -> 'Derivation'
from_source¶
func¶
historical_table¶
into¶
into(model, *, map, key=None, where=None, on_conflict='error', acknowledge_overwrite=False, priority=None) -> 'TransitionTarget'
literal¶
mapping¶
merge_sources¶
param¶
rows¶
rows(*, key=None, rows=None, source=None, owned_columns=None, on_missing='keep', scope=None, acknowledge_delete=False, archive_to=None, acknowledge_archive=False, rollback='irreversible', category=None) -> 'ManagedRows'
validate¶
winner¶
dbwarden.database¶
get_db_connection¶
Re-export of dbwarden.connection.connection.get_db_connection.
reset_connection_logging¶
Re-export of dbwarden.connection.connection.reset_connection_logging.
QueryMethod¶
Re-export of dbwarden.connection.queries.store.QueryMethod.
get_query¶
Re-export of dbwarden.connection.queries.get_query.
dbwarden.databases¶
CheckSpec¶
Declared fields: expression, name, no_inherit.
Methods declared on this class:
DBWardenMeta¶
DBWardenMeta(comment: 'str | None' = None, indexes: 'list[Any]' = <factory>, checks: 'list[Any]' = <factory>, uniques: 'list[Any]' = <factory>, primary_key: 'list[str]' = <factory>, partition: 'Any' = None, backend_table: 'Any' = None, pg_indexes: 'list[Any]' = <factory>, pg_checks: 'list[Any]' = <factory>, pg_uniques: 'list[Any]' = <factory>, pg_excludes: 'list[Any]' = <factory>, ch_indexes: 'list[Any]' = <factory>, my_indexes: 'list[Any]' = <factory>, my_checks: 'list[Any]' = <factory>, my_uniques: 'list[Any]' = <factory>, sq_indexes: 'list[Any]' = <factory>, table_attrs: 'dict[str, Any]' = <factory>) -> None
Declared fields: comment, indexes, checks, uniques, primary_key, partition, backend_table, pg_indexes, pg_checks, pg_uniques, pg_excludes, ch_indexes, my_indexes, my_checks, my_uniques, sq_indexes, table_attrs.
IndexSpec¶
IndexSpec(columns: 'list[str]', name: 'str | None' = None, unique: 'bool' = False, using: 'str | None' = None, where: 'str | None' = None, include: 'list[str] | None' = None, with_params: 'dict[str, Any] | None' = None, tablespace: 'str | None' = None, nulls_not_distinct: 'bool' = False, column_sorting: 'dict[str, str] | None' = None, comment: 'str | None' = None, concurrently: 'bool' = True, clickhouse_type: 'str | None' = None, clickhouse_granularity: 'int | None' = None) -> None
Declared fields: columns, name, unique, using, where, include, with_params, tablespace, nulls_not_distinct, column_sorting, comment, concurrently, clickhouse_type, clickhouse_granularity.
Methods declared on this class:
Seed¶
Re-export of dbwarden.seed.Seed.
SeedRow¶
Re-export of dbwarden.seed.SeedRow.
TableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key.
UniqueSpec¶
UniqueSpec(columns: 'list[str]', name: 'str | None' = None, nulls_not_distinct: 'bool' = False, deferrable: 'bool' = False, initially_deferred: 'bool' = False, include: 'list[str] | None' = None) -> None
Declared fields: columns, name, nulls_not_distinct, deferrable, initially_deferred, include.
Methods declared on this class:
apply_meta¶
attach_meta¶
ch¶
check¶
mdb¶
my¶
pg¶
read_meta¶
seed_data¶
Re-export of dbwarden.seed.seed_data.
sq¶
unique¶
unique(name: 'str', columns: 'list[str]', *, nulls_not_distinct: 'bool' = False, deferrable: 'bool' = False, initially_deferred: 'bool' = False, include: 'list[str] | None' = None) -> 'dict[str, Any]'
dbwarden.databases.clickhouse¶
AggregatingView¶
Declared fields: .
AggregatingViewSpec¶
AggregatingViewSpec(source: 'Any' = '', group_by: 'tuple[Any, ...]' = (), aggregates: 'tuple[Any, ...]' = (), order_by: 'tuple[Any, ...]' = (), partition_by: 'Any | None' = None, ttl: 'tuple[Any, ...] | None' = None, settings: 'dict[str, str] | None' = None, target_name: 'str | None' = None) -> None
Declared fields: source, group_by, aggregates, order_by, partition_by, ttl, settings, target_name.
Methods declared on this class:
AggExpr¶
Declared fields: func, arg, arg_types, alias.
Methods declared on this class:
as_(self, alias: 'str') -> 'AggExpr'
target_type(self) -> 'str'
state_combinator(self, source_column_type: 'str | None' = None) -> 'str'
ChAggStateType¶
ChEngineSpec¶
Re-export of dbwarden.databases.clickhouse.engine.ChEngineSpec.
ChFieldSpec¶
ChFieldSpec(codec: 'str | None' = None, default_expression: 'str | None' = None, materialized: 'str | None' = None, alias: 'str | None' = None, ephemeral: 'str | None' = None, ttl: 'str | None' = None, low_cardinality: 'bool' = False, nullable: 'bool' = False, type: 'str | None' = None) -> None
Declared fields: codec, default_expression, materialized, alias, ephemeral, ttl, low_cardinality, nullable, type.
Methods declared on this class:
ChGrantSpec¶
ChGrantSpec(privileges: 'tuple[str, ...]', on: 'str', to: 'str', with_grant_option: 'bool' = False) -> None
Declared fields: privileges, on, to, with_grant_option.
ChIndexSpec¶
ChIndexSpec(name: 'str', columns: 'list[str]', type: "Literal['minmax', 'set', 'bloom_filter', 'ngrambf_v1', 'tokenbf_v1', 'hypothesis'] | str" = 'minmax', granularity: 'int' = 1, expr: 'str | None' = None) -> None
Declared fields: name, columns, type, granularity, expr.
Methods declared on this class:
ChQuotaSpec¶
ChQuotaSpec(name: 'str', interval: 'str', limits: 'dict[str, int]', to_roles: 'tuple[str, ...]' = ('ALL',)) -> None
Declared fields: name, interval, limits, to_roles.
ChRaw¶
Declared fields: sql.
ChRoleSpec¶
Declared fields: name, settings.
ChRowPolicySpec¶
ChRowPolicySpec(name: 'str', table: 'str', using: 'str', to_roles: 'tuple[str, ...]' = ('ALL',), permissive: 'bool' = True) -> None
Declared fields: name, table, using, to_roles, permissive.
ChSettingsProfileSpec¶
ChSettingsProfileSpec(name: 'str', settings: 'dict[str, str]', to_roles: 'tuple[str, ...]' = ()) -> None
Declared fields: name, settings, to_roles.
ChTableSpec¶
ChTableSpec(engine: 'ChEngineSpec | str | None' = None, order_by: 'list[Any] | Any | None' = None, primary_key: 'list[Any] | Any | None' = None, partition_by: 'Any | None' = None, sample_by: 'Any | None' = None, ttl: 'list[Any] | Any | None' = None, settings: 'MergeTreeSettings | None' = None, projections: 'list[ProjectionSpec] | None' = None, indexes: 'list[ChIndexSpec] | None' = None, zookeeper_path: 'str | None' = None, replica_name: 'str | None' = None, select_statement: 'Any | None' = None, to_table: 'str | None' = None) -> None
Declared fields: engine, order_by, primary_key, partition_by, sample_by, ttl, settings, projections, indexes, zookeeper_path, replica_name, select_statement, to_table.
ChUserSpec¶
ChUserSpec(name: 'str', auth: 'str' = 'no_password', roles: 'tuple[str, ...]' = (), default_roles: 'tuple[str, ...]' = (), host: 'str' = 'ANY', settings_profile: 'str | None' = None) -> None
Declared fields: name, auth, roles, default_roles, host, settings_profile.
CHColumnMeta¶
Declared fields: comment, public, ch.
CHTableMeta¶
Re-export of dbwarden.schema.table_meta.CHTableMeta.
CHViewMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, ch.
ChView¶
Declared fields: .
ClusterMode¶
DataOp¶
DataOp(name: 'str', forward: 'str', rollback: 'str | None' = None, requires_confirmation: 'bool' = False) -> None
Declared fields: name, forward, rollback, requires_confirmation.
DictSpec¶
DictSpec(layout: 'str', source: 'dict[str, Any] | str', lifetime: 'int | str | None' = None, primary_key: 'str | list[str] | None' = None) -> None
Declared fields: layout, source, lifetime, primary_key.
Methods declared on this class:
KafkaSettings¶
Declared fields: kafka_broker_list, kafka_topic_list, kafka_group_name, kafka_format, kafka_row_delimiter, kafka_schema, kafka_num_consumers, kafka_max_block_size, kafka_skip_broken_messages, kafka_commit_every_batch, kafka_client_id, kafka_poll_timeout_ms, kafka_flush_interval_ms, kafka_thread_per_consumer, kafka_handle_error_mode.
MaterializedView¶
Declared fields: .
MaterializedViewSpec¶
MaterializedViewSpec(name: 'str | None' = None, select: 'Any' = None, to: 'str | None' = None, refresh: 'str | None' = None, populate: 'bool' = False, engine: 'Any' = None, order_by: 'Any' = None, partition_by: 'Any' = None, ttl: 'Any' = None, settings: 'dict[str, str] | None' = None) -> None
Declared fields: name, select, to, refresh, populate, engine, order_by, partition_by, ttl, settings.
Methods declared on this class:
MergeTreeSettings¶
Declared fields: index_granularity, index_granularity_bytes, min_index_granularity_bytes, enable_mixed_granularity_parts, ttl_only_drop_parts, merge_with_ttl_timeout, merge_with_recompression_ttl_timeout, write_final_mark, merge_max_block_size, max_part_loading_threads, max_parts_in_total, replicated_deduplication_window, replicated_deduplication_window_seconds, replicated_can_become_leader, min_bytes_for_wide_part, min_rows_for_wide_part, max_parts_in_memory, max_bytes_to_merge_at_max_space_in_pool, min_bytes_to_use_direct_io, merge_tree_clear_old_broken_detached, parts_to_throw_insert, parts_to_delay_insert, inactive_parts_to_throw_in_insert, inactive_parts_to_delay_in_insert, max_delay_to_insert, max_suspicious_broken_parts.
NamedCollectionSpec¶
NamedCollectionSpec(name: 'str', entries: 'dict[str, str]' = <factory>, overridable: 'dict[str, bool] | None' = None) -> None
Declared fields: name, entries, overridable.
Methods declared on this class:
NATSSettings¶
Declared fields: nats_url, nats_subjects, nats_format, nats_num_consumers, nats_max_block_size, nats_skip_broken_messages, nats_flush_interval_ms, nats_commit_every_batch, nats_username, nats_password.
ProjectionSpec¶
Declared fields: name, query.
Methods declared on this class:
RabbitMQSettings¶
Declared fields: rabbitmq_host, rabbitmq_port, rabbitmq_virtual_host, rabbitmq_username, rabbitmq_password, rabbitmq_routing_key_list, rabbitmq_exchange_name, rabbitmq_format, rabbitmq_exchange_type, rabbitmq_routing_key, rabbitmq_num_consumers, rabbitmq_max_block_size, rabbitmq_flush_interval_ms, rabbitmq_skip_broken_messages, rabbitmq_commit_every_batch, rabbitmq_queue_base, rabbitmq_persistent.
RedisSettings¶
Declared fields: redis_host, redis_port, redis_password, redis_storage.
S3QueueSettings¶
Declared fields: s3queue_buckets, s3queue_processing_threads, s3queue_tracking_poll_timeout_ms, s3queue_tracking_window_ms, s3queue_last_processed_node.
S3Settings¶
Declared fields: s3_access_key_id, s3_secret_access_key, s3_format, s3_compression, s3_compression_method, s3_compression_level.
URLSettings¶
Declared fields: url, url_format.
agg¶
aggregating_merge_tree¶
aggregating_view¶
aggregating_view(*, source: 'Any', group_by: 'Any' = None, aggregates: 'Any' = None, order_by: 'Any' = None, partition_by: 'Any' = None, ttl: 'Any' = None, settings: 'dict[str, str] | None' = None, name: 'str | None' = None, **deprecated: 'Any') -> 'AggregatingViewSpec'
buffer¶
buffer(database: 'str', table: 'str', num_layers: 'int', min_time: 'int', max_time: 'int', min_rows: 'int', max_rows: 'int', min_bytes: 'int', max_bytes: 'int', *, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
ch¶
ch_agg_state¶
ch_raw¶
ch_table¶
ch_table(*, engine: 'ChEngineSpec | str | None' = None, order_by: 'Any' = None, primary_key: 'Any' = None, partition_by: 'Any' = None, sample_by: 'Any' = None, ttl: 'Any' = None, settings: 'MergeTreeSettings | None' = None, projections: 'list[ProjectionSpec] | None' = None, indexes: 'list[ChIndexSpec] | None' = None, zookeeper_path: 'str | None' = None, replica_name: 'str | None' = None) -> 'ChTableSpec'
ch_view_tables_from_models¶
ch_view_tables_from_models(model_paths: 'list[str] | None' = None, db_name: 'str | None' = None) -> 'list[ModelTable]'
collapsing_merge_tree¶
collapsing_merge_tree(sign_col: 'str', *, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
column_name_from_expr¶
data_op¶
data_op(*, name: 'str', forward: 'str', rollback: 'str | None' = None, requires_confirmation: 'bool' = False) -> 'DataOp'
data_ops¶
data_ops_populate¶
data_ops_populate(spec: 'MaterializedViewSpec | AggregatingViewSpec | dict[str, Any]', *, name: 'str | None' = None, rollback: 'str | None' = None) -> 'DataOp'
derive_agg_target_columns¶
dictionary¶
dictionary(*, layout: 'str', source: 'dict[str, Any] | str', lifetime: 'int | str | None' = None, primary_key: 'str | list[str] | None' = None) -> 'DictSpec'
dictionary_engine¶
distributed¶
distributed(cluster: 'str', database: 'str', table: 'str', sharding_key: 'str | None' = None, *, policy_name: 'str | None' = None, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
field¶
field(*, codec: 'str | None' = None, default_expression: 'str | None' = None, materialized: 'str | None' = None, alias: 'str | None' = None, ephemeral: 'str | None' = None, ttl: 'str | None' = None, low_cardinality: 'bool' = False, nullable: 'bool' = False, type: 'str | None' = None) -> 'ChFieldSpec'
file_engine¶
get_all_ch_views¶
get_all_ch_views(model_paths: 'list[str] | None' = None, db_name: 'str | None' = None) -> 'list[dict[str, Any]]'
graphite_merge_tree¶
graphite_merge_tree(config_section: 'str' = 'default', *, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
hdfs¶
join_engine¶
kafka¶
kafka(*, named_collection: 'str | None' = None, broker_list: 'str | None' = None, topic_list: 'str | None' = None, group_name: 'str | None' = None, format: 'str | None' = None, num_consumers: 'int | None' = None) -> 'ChEngineSpec'
log¶
materialized_view¶
materialized_view(*, name: 'str | None' = None, select: 'Any' = None, to: 'str | None' = None, refresh: 'str | None' = None, populate: 'bool' = False, engine: 'Any' = None, order_by: 'Any' = None, partition_by: 'Any' = None, ttl: 'Any' = None, settings: 'dict[str, str] | None' = None, **deprecated: 'Any') -> 'MaterializedViewSpec'
memory¶
merge¶
merge_tree¶
mongodb¶
mongodb(host: 'str', port: 'int', database: 'str', table: 'str', user: 'str', password: 'str') -> 'ChEngineSpec'
mysql_engine¶
mysql_engine(host: 'str', port: 'int', database: 'str', table: 'str', user: 'str', password: 'str') -> 'ChEngineSpec'
named_collection¶
named_collection(name: 'str', *, overridable: 'dict[str, bool] | None' = None, **entries: 'str') -> 'NamedCollectionSpec'
nats¶
nats(*, named_collection: 'str | None' = None, url: 'str | None' = None, subjects: 'str | None' = None, format: 'str | None' = None) -> 'ChEngineSpec'
null¶
postgresql_engine¶
postgresql_engine(host: 'str', port: 'int', database: 'str', table: 'str', user: 'str', password: 'str') -> 'ChEngineSpec'
projection¶
rabbitmq¶
rabbitmq(*, named_collection: 'str | None' = None, host: 'str | None' = None, format: 'str | None' = None, exchange_name: 'str | None' = None, routing_key: 'str | None' = None) -> 'ChEngineSpec'
redis¶
render_expr¶
render_expr_list¶
replicated_merge_tree¶
replicated_merge_tree(zookeeper_path: 'str', replica_name: 'str', *args: 'str', settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
replacing_merge_tree¶
replacing_merge_tree(version_col: 'str | None' = None, *, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
s3¶
s3(*, named_collection: 'str | None' = None, path: 'str | None' = None, format: 'str | None' = None, compression: 'str | None' = None, access_key_id: 'str | None' = None, secret_access_key: 'str | None' = None) -> 'ChEngineSpec'
s3_queue¶
s3_queue(*, named_collection: 'str | None' = None, path: 'str | None' = None, format: 'str | None' = None, compression: 'str | None' = None) -> 'ChEngineSpec'
set_engine¶
skip_index¶
skip_index(name: 'str', columns: 'list[str]', type: "Literal['minmax', 'set', 'bloom_filter', 'ngrambf_v1', 'tokenbf_v1', 'hypothesis'] | str" = 'minmax', *, granularity: 'int' = 1, expr: 'str | None' = None) -> 'ChIndexSpec'
stripe_log¶
summing_merge_tree¶
tiny_log¶
url_engine¶
versioned_collapsing_merge_tree¶
versioned_collapsing_merge_tree(sign_col: 'str', version_col: 'str', *, settings: 'MergeTreeSettings | None' = None) -> 'ChEngineSpec'
dbwarden.databases.mariadb¶
MdbColumnMeta¶
Declared fields: comment, public, mdb.
MdbFieldSpec¶
MdbFieldSpec(invisible: 'bool' = False, without_overlaps: 'bool' = False, sequence: 'str | None' = None) -> None
Declared fields: invisible, without_overlaps, sequence.
Methods declared on this class:
MdbTableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, my_engine, my_charset, my_collate, my_row_format, my_auto_increment, my_indexes, my_checks, my_uniques, mdb_page_compressed, mdb_page_compression_level.
MdbTableSpec¶
MdbTableSpec(engine: 'str' = 'InnoDB', charset: 'str' = 'utf8mb4', collate: 'str' = 'utf8mb4_unicode_ci', row_format: 'str | None' = None, auto_increment: 'int | None' = None, page_compressed: 'bool' = False, page_compression_level: 'int | None' = None) -> None
Declared fields: engine, charset, collate, row_format, auto_increment, page_compressed, page_compression_level.
field¶
field(*, invisible: 'bool' = False, without_overlaps: 'bool' = False, sequence: 'str | None' = None) -> 'MdbFieldSpec'
mdb¶
dbwarden.databases.mysql¶
MyColumnMeta¶
Re-export of dbwarden.schema.table_meta.MyColumnMeta.
MyFieldSpec¶
MyFieldSpec(charset: 'str | None' = None, collate: 'str | None' = None, unsigned: 'bool' = False, on_update: 'str | None' = None) -> None
Declared fields: charset, collate, unsigned, on_update.
Methods declared on this class:
MyTableMeta¶
Re-export of dbwarden.schema.table_meta.MyTableMeta.
MyTableSpec¶
MyTableSpec(engine: 'str' = 'InnoDB', charset: 'str' = 'utf8mb4', collate: 'str' = 'utf8mb4_unicode_ci', row_format: 'str | None' = None, auto_increment: 'int | None' = None) -> None
Declared fields: engine, charset, collate, row_format, auto_increment.
field¶
field(*, charset: 'str | None' = None, collate: 'str | None' = None, unsigned: 'bool' = False, on_update: 'str | None' = None) -> 'MyFieldSpec'
my¶
dbwarden.databases.pgsql¶
ExcludeSpec¶
ExcludeSpec(name: 'str | None' = None, using: 'str' = 'gist', where: 'str | None' = None, elements: 'list[dict[str, Any]] | None' = None) -> None
Declared fields: name, using, where, elements.
Methods declared on this class:
PGColumnMeta¶
Declared fields: comment, public, pg.
PGTableMeta¶
Declared fields: comment, indexes, checks, uniques, primary_key, pg_schema, pg_fillfactor, pg_tablespace, pg_inherits, pg_partition_of, pg_partition_bound, pg_unlogged, pg_checks, pg_uniques, pg_excludes, pg_indexes, pg_partition, pg_rls, pg_rls_force, pg_policies, pg_grants, pg_storage_params.
PGViewMeta¶
Re-export of dbwarden.schema.table_meta.PGViewMeta.
PgFieldSpec¶
PgFieldSpec(collation: 'str | None' = None, storage: 'str | None' = None, compression: 'str | None' = None, generated: 'str | None' = None, identity: 'str | None' = None, identity_start: 'int | None' = None, identity_increment: 'int | None' = None, identity_min: 'int | None' = None, identity_max: 'int | None' = None) -> None
Declared fields: collation, storage, compression, generated, identity, identity_start, identity_increment, identity_min, identity_max.
Methods declared on this class:
PgIndexSpec¶
PgIndexSpec(name: 'str', columns: 'list[str]', unique: 'bool' = False, using: 'str | None' = None, where: 'str | None' = None, include: 'list[str] | None' = None, with_params: 'dict[str, Any] | None' = None, tablespace: 'str | None' = None, nulls_not_distinct: 'bool' = False, column_sorting: 'dict[str, str] | None' = None, postgresql_ops: 'dict[str, str] | None' = None, concurrently: 'bool' = True, expression: 'str | None' = None) -> None
Declared fields: name, columns, unique, using, where, include, with_params, tablespace, nulls_not_distinct, column_sorting, postgresql_ops, concurrently, expression.
Methods declared on this class:
PgTableSpec¶
PgTableSpec(tablespace: 'str | None' = None, fillfactor: 'int | None' = None, unlogged: 'bool' = False, inherits: 'list[str] | None' = None, schema: 'str | None' = None, partition: 'dict | None' = None) -> None
Declared fields: tablespace, fillfactor, unlogged, inherits, schema, partition.
PgViewSpec¶
PgViewSpec(query: 'str | None' = None, materialized: 'bool' = False, schema: 'str | None' = None, auto_refresh: 'bool' = False) -> None
Declared fields: query, materialized, schema, auto_refresh.
exclude¶
exclude(name: 'str', *, using: 'str' = 'gist', where: 'str | None' = None, elements: 'list[dict[str, Any]] | None' = None) -> 'dict[str, Any]'
field¶
field(*, collation: 'str | None' = None, storage: 'str | None' = None, compression: 'str | None' = None, generated: 'str | None' = None, identity: 'str | None' = None, identity_start: 'int | None' = None, identity_increment: 'int | None' = None, identity_min: 'int | None' = None, identity_max: 'int | None' = None) -> 'PgFieldSpec'
index¶
index(name: 'str', columns: 'list[str]', *, unique: 'bool' = False, using: 'str | None' = None, where: 'str | None' = None, include: 'list[str] | None' = None, with_params: 'dict[str, Any] | None' = None, tablespace: 'str | None' = None, nulls_not_distinct: 'bool' = False, column_sorting: 'dict[str, str] | None' = None, postgresql_ops: 'dict[str, str] | None' = None, concurrently: 'bool' = True, expression: 'str | None' = None) -> 'dict[str, Any]'
partition_by_hash¶
partition_by_list¶
partition_by_range¶
pg¶
dbwarden.databases.sqlite¶
SqColumnMeta¶
Re-export of dbwarden.schema.table_meta.SqColumnMeta.
SqFieldSpec¶
SqFieldSpec(generated: 'str | None' = None, generated_mode: 'str' = 'STORED', collate: 'str | None' = None) -> None
Declared fields: generated, generated_mode, collate.
Methods declared on this class:
SqTableMeta¶
Re-export of dbwarden.schema.table_meta.SqTableMeta.
SqTableSpec¶
Declared fields: without_rowid, strict.
field¶
field(*, generated: 'str | None' = None, generated_mode: 'str' = 'STORED', collate: 'str | None' = None) -> 'SqFieldSpec'
sq¶
dbwarden.db_handle¶
DatabaseHandle¶
Methods declared on this class:
dbwarden.engine.backends.clickhouse¶
Safety¶
analyze_clickhouse_options¶
analyze_clickhouse_options(table_snapshot: 'dict[str, Any]', model_table: 'ModelTable') -> 'list[SafetyIssue]'
classify_ch_column_change¶
classify_ch_options_change¶
classify_ch_safety¶
classify_ch_safety(op: 'dict', model_column: 'Any' = None, snapshot_column: 'Any' = None) -> 'list[SafetyIssue]'
extract_balanced_parens¶
parse_dict_layout¶
parse_dict_lifetime¶
parse_dict_primary_key¶
parse_dict_source¶
parse_mv_query¶
parse_mv_to_table¶
parse_projection_names¶
parse_projection_queries¶
parse_replica_name¶
parse_settings¶
parse_ttl_expressions¶
parse_tuple_or_list¶
parse_zookeeper_path¶
dbwarden.engine.backends.clickhouse.handlers¶
ChAggTargetHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChColumnHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChCommentHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChDataOpHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'tuple[list[Op], list[Op]]'
emit(self, op: 'Op', db_name: 'str | None' = None, **kwargs: 'Any') -> 'list[MigrationStatement]'
ChDictionaryHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChMaterializedViewHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChProjectionHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChSkipIndexHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ChTableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types, clickhouse_engine_recreate.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
dbwarden.engine.backends.mariadb¶
append_mariadb_column_attrs¶
assert_complete_mariadb_type¶
extract_mariadb_meta¶
extract_mariadb_meta(connection, table_name: 'str', indexes: 'list[dict] | None' = None, checks: 'list[dict] | None' = None, uniques: 'list[dict] | None' = None) -> 'tuple[dict[str, Any], dict[str, dict[str, Any]]]'
mariadb_column_definition_for_meta¶
mariadb_column_definition_for_meta(col_type: 'str', meta: 'dict[str, Any]', nullable: 'bool | None' = None, default: 'str | None' = None, comment: 'str | None' = None, autoincrement: 'bool | None' = None) -> 'str'
normalize_mariadb_default¶
normalize_mariadb_table_value¶
render_mariadb_column_type¶
resolve_mariadb_imports¶
dbwarden.engine.backends.mysql¶
append_mysql_column_attrs¶
assert_complete_mysql_type¶
build_mysql_alter_default_sql¶
build_mysql_alter_default_sql(table: 'str', column: 'str', default: 'Any', col_type: 'str | None' = None, nullable: 'bool | None' = None, my_meta: 'dict[str, Any] | None' = None) -> 'tuple[str, str]'
extract_mysql_meta¶
extract_mysql_meta(connection, table_name: 'str', indexes: 'list[dict] | None' = None, checks: 'list[dict] | None' = None, uniques: 'list[dict] | None' = None) -> 'tuple[dict[str, Any], dict[str, dict[str, Any]]]'
mysql_column_definition_for_meta¶
mysql_column_definition_for_meta(col_type: 'str', meta: 'dict[str, Any]', nullable: 'bool | None' = None, default: 'str | None' = None, comment: 'str | None' = None, autoincrement: 'bool | None' = None) -> 'str'
normalize_mysql_default¶
normalize_mysql_table_value¶
render_mysql_column_type¶
resolve_mysql_imports¶
dbwarden.engine.backends.mysql.handlers¶
MyTableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
dbwarden.engine.backends.postgresql¶
classify_enum_change¶
classify_pg_type_change¶
dbwarden.engine.backends.postgresql.handlers¶
ColumnHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ConstraintHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
IndexHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
PartitionHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
PgTableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
RenameTableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
SchemaHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
StatisticsHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
TableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
TypeHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
ViewHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
dbwarden.engine.backends.sqlite¶
extract_sqlite_column_meta¶
extract_sqlite_column_meta(inspector, connection, table_name: 'str', raw_columns: 'list[dict] | None' = None) -> 'dict[str, dict[str, Any]]'
extract_sqlite_meta¶
extract_sqlite_meta(connection, table_name: 'str', indexes: 'list[dict] | None' = None, checks: 'list[dict] | None' = None, uniques: 'list[dict] | None' = None, raw_columns: 'list[dict] | None' = None) -> 'tuple[dict[str, Any], dict[str, dict[str, Any]]]'
extract_sqlite_table_meta¶
resolve_sqlite_imports¶
dbwarden.engine.backends.sqlite.handlers¶
SqTableHandler¶
Declared fields: object_type, run_phase, statement_order, ordering, op_types.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
dbwarden.engine.core¶
RunPhase¶
Op¶
Op(object_type: 'str', upgrade_attrs: 'dict[str, Any]' = <factory>, rollback_attrs: 'dict[str, Any]' = <factory>, irreversible: 'bool' = False, category: 'str | None' = None, safety: 'str | None' = None) -> None
Declared fields: object_type, upgrade_attrs, rollback_attrs, irreversible, category, safety.
ObjectHandler¶
Declared fields: object_type, run_phase, statement_order, ordering.
Methods declared on this class:
extract(self, snapshot: 'dict[str, Any]') -> 'dict[str, Any]'
model_spec_from_config(self, config: 'Any') -> 'dict[str, Any]'
model_spec_from_tables(self, model_tables: 'list[Any]') -> 'dict[str, Any]'
canonicalize(self, spec: 'dict[str, Any]') -> 'dict[str, Any]'
diff(self, snap_spec: 'dict[str, Any]', model_spec: 'dict[str, Any]') -> 'Tuple[List[Op], List[Op]]'
emit(self, op: 'Op', db_name: 'Optional[str]' = None, **kwargs: 'Any') -> 'List[MigrationStatement]'
Anchor¶
OrderingConstraint¶
OrderingConstraint(after: 'tuple[Anchor, ...]' = (), before: 'tuple[Anchor, ...]' = (), after_object: 'tuple[str, ...]' = (), before_object: 'tuple[str, ...]' = ()) -> None
Declared fields: after, before, after_object, before_object.
OrderingError¶
StatementOrder¶
MigrationStatement¶
MigrationStatement(order: 'StatementOrder', upgrade_sql: 'str', rollback_sql: 'str', rollback_kind: 'str' = 'real', rollback_reason: 'str | None' = None, category: 'str | None' = None, safety: 'str | None' = None) -> None
Declared fields: order, upgrade_sql, rollback_sql, rollback_kind, rollback_reason, category, safety.
Change¶
Change(operation: str, table: str, target: str | None = None, resolved_from: str | None = None, index_type: str | None = None) -> None
Declared fields: operation, table, target, resolved_from, index_type.
RegistryDriver¶
Methods declared on this class:
register(self, handler: 'ObjectHandler') -> 'None'
run(self, snapshot: 'dict[str, Any]', model_tables: 'list[Any]', config: 'Any') -> 'Tuple[List[Op], List[Op]]'
emit_all(self, ops: 'List[Op]', db_name: 'Optional[str]' = None, cluster_ctx: 'Any' = None) -> 'List[MigrationStatement]'
emit_op_to_sql(self, upgrade_ops: 'List[Op]', rollback_ops: 'List[Op]', db_name: 'Optional[str]' = None, cluster_ctx: 'Any' = None) -> 'Tuple[str, str, List[Change]]'
ModelColumn¶
ModelColumn(name: 'str', type: 'str', nullable: 'bool', primary_key: 'bool', unique: 'bool', default: 'Optional[str]', foreign_key: 'Optional[str]', codec: 'Optional[str]' = None, comment: 'Optional[str]' = None, pg_meta: 'Optional[dict[str, Any]]' = None, ch_meta: 'Optional[dict[str, Any]]' = None, my_meta: 'Optional[dict[str, Any]]' = None, sq_meta: 'Optional[dict[str, Any]]' = None, autoincrement: 'Optional[bool]' = None, fk_on_delete: 'Optional[str]' = None, fk_on_update: 'Optional[str]' = None)
Methods declared on this class:
IndexInfo¶
IndexInfo(columns: 'list[str]', name: 'str | None' = None, unique: 'bool' = False, using: 'str | None' = None, where: 'str | None' = None, include: 'list[str] | None' = None, with_params: 'dict[str, Any] | None' = None, tablespace: 'str | None' = None, nulls_not_distinct: 'bool' = False, column_sorting: 'dict[str, str] | None' = None, postgresql_ops: 'dict[str, str] | None' = None, comment: 'str | None' = None, concurrently: 'bool' = True, clickhouse_type: 'str | None' = None, clickhouse_granularity: 'int | None' = None, expression: 'str | None' = None) -> None
Declared fields: columns, name, unique, using, where, include, with_params, tablespace, nulls_not_distinct, column_sorting, postgresql_ops, comment, concurrently, clickhouse_type, clickhouse_granularity, expression.
Methods declared on this class:
ModelTable¶
ModelTable(name: 'str', columns: 'List[ModelColumn]', clickhouse_options: 'Optional[dict]' = None, object_type: 'str' = 'table', foreign_keys: 'Optional[list[dict]]' = None, indexes: 'Optional[list[dict | IndexInfo]]' = None, comment: 'str | None' = None, checks: 'Optional[list[dict[str, Any]]]' = None, uniques: 'Optional[list[dict[str, Any]]]' = None, excludes: 'Optional[list[dict[str, Any]]]' = None, pg_table: 'Optional[dict[str, Any]]' = None, my_table: 'Optional[dict[str, Any]]' = None, sq_table: 'Optional[dict[str, Any]]' = None, schema: 'str | None' = None, pg_view_definition: 'str | None' = None, pg_view_materialized: 'bool' = False, pg_view_auto_refresh: 'bool' = False, pg_policies: 'Optional[list[dict[str, Any]]]' = None, pg_grants: 'Optional[list[dict[str, Any]]]' = None)
Methods declared on this class:
STATE_FORMAT_VERSION¶
model_state_to_dict¶
normalize_model_state¶
reconstruct_model_table¶
reconstruct_model_column¶
compute_checksum¶
get_schemas_directory¶
write_snapshot¶
write_snapshot(snapshot: 'dict[str, Any]', database: 'str | None' = None, migration_id: 'str' = '') -> 'str'
read_snapshot¶
find_latest_snapshot¶
extract_snapshot_tables¶
TableRenameIntent¶
Declared fields: old_table, new_table.
RENAME_TABLE_OVERLAP_THRESHOLD¶
detect_renames¶
detect_renames(table_name: 'str', dropped_columns: 'list[tuple[str, dict[str, Any]]]', added_columns: 'list[tuple[str, ModelColumn]]') -> 'list[tuple[str, str]]'
dbwarden.engine.core.plugin_api¶
ClusterableStatement¶
Declared fields: prefix, suffix, supports_cluster.
Methods declared on this class:
render(self, ctx: 'ClusterContext') -> 'str'
from_sql(sql: 'str') -> "'ClusterableStatement'"
to_migration(self, order: "'StatementOrder'", ctx: 'ClusterContext', rollback: "'ClusterableStatement | str | None'" = None) -> 'MigrationStatement'
REDACTED¶
build_alter_policy_sql¶
build_create_policy_sql¶
build_grant_sql¶
build_revoke_sql¶
emit_with_cluster¶
has_visible_secrets¶
qualified_name¶
quote_pg¶
strip_secret_values¶
dbwarden.engine.model_discovery¶
IndexInfo¶
Re-export of dbwarden.engine.core.models.IndexInfo.
ModelColumn¶
Re-export of dbwarden.engine.core.models.ModelColumn.
ModelTable¶
Re-export of dbwarden.engine.core.models.ModelTable.
DBWardenConfigError¶
auto_discover_model_paths¶
Re-export of dbwarden.engine.model_discovery.path_discovery.auto_discover_model_paths.
discover_models_in_directory¶
load_model_from_path¶
extract_column_info¶
extract_column_info(column, db_name: str | None = None, backend: str | None = None) -> dbwarden.engine.core.models.ModelColumn | None
extract_table_from_model¶
extract_table_from_model(model_class: type, db_name: str | None = None) -> dbwarden.engine.core.models.ModelTable | None
extract_tables_from_database¶
extract_tables_from_migrations¶
filter_model_tables_by_name¶
filter_model_tables_by_name(tables: list[dbwarden.engine.core.models.ModelTable], allowed_names: list[str] | None) -> list[dbwarden.engine.core.models.ModelTable]
validate_model_tables_exist¶
validate_model_tables_exist(discovered_tables: list[dbwarden.engine.core.models.ModelTable], configured_names: list[str] | None, db_name: str) -> None
generate_add_column_sql¶
generate_add_column_sql(table_name: str, column: dbwarden.engine.core.models.ModelColumn, db_name: str | None = None, schema: str | None = None) -> str
generate_create_table_sql¶
generate_create_table_sql(table: dbwarden.engine.core.models.ModelTable, db_name: str | None = None) -> str
generate_drop_object_sql¶
generate_drop_table_sql¶
get_all_model_tables¶
Re-export of dbwarden.engine.model_discovery.get_all_model_tables.
get_model_table_by_name¶
get_model_table_by_name(table_name: str, model_paths: list[str] | None = None, db_name: str | None = None) -> dbwarden.engine.core.models.ModelTable | None
dbwarden.exceptions¶
ConfigurationError¶
DBDisconnectedError¶
DBWardenConfigError¶
Re-export of dbwarden.exceptions.core.DBWardenConfigError.
DBWardenError¶
DatabaseError¶
DirectoryNotFoundError¶
HookConflictError¶
HookNotRegisteredError¶
HookValidationError¶
HookVetoError¶
ImmutableChangeError¶
LockAcquireTimeout¶
LockError¶
LockStuck¶
NoMigrationsError¶
NoSeedsError¶
ObjectHandlerConflictError¶
OrderingError¶
Re-export of dbwarden.exceptions.engine.OrderingError.
PendingMigrationsError¶
PluginApiMismatchError¶
PluginInstallError¶
RecoveryRequired¶
RollbackContractError¶
SeedError¶
VersionNotFoundError¶
dbwarden.merge¶
SupersededMarker¶
SupersededMarker(merged_into: 'str', merged_at: 'str', merge_base: 'str', branch: 'str', applied_persistent: 'str', file_checksum: 'str') -> None
Declared fields: merged_into, merged_at, merge_base, branch, applied_persistent, file_checksum.
parse_superseded_marker¶
write_superseded_marker¶
is_superseded¶
get_file_checksum¶
ReconciliationHeader¶
ReconciliationHeader(merge_base: 'str', merge_base_checksum: 'str', supersedes: 'list[str]', probe_results: 'dict[str, str]', generated_by: 'str', renames: 'list[dict] | None' = None) -> None
Declared fields: merge_base, merge_base_checksum, supersedes, probe_results, generated_by, renames.
parse_reconciliation_header¶
write_reconciliation_header¶
is_reconciliation¶
MergeSignal¶
detect_merge_signals¶
EnvironmentConfig¶
Re-export of dbwarden.merge.environments.EnvironmentConfig.
load_environments¶
is_persistent¶
get_persistent_environments¶
dbwarden.models¶
MigrationType¶
MigrationDirection¶
MigrationRecord¶
MigrationRecord(order_executed: int, version: str | None, description: str, filename: str, migration_type: str, applied_at: datetime.datetime, checksum: str | None) -> None
Declared fields: order_executed, version, description, filename, migration_type, applied_at, checksum.
MigrationFile¶
MigrationFile(version: str | None, filename: str, filepath: str, upgrade_sql: list[str], rollback_sql: list[str], checksum: str) -> None
Declared fields: version, filename, filepath, upgrade_sql, rollback_sql, checksum.
SchemaDifference¶
Declared fields: type, table_name, column_name, sql.
SeedRecord¶
SeedRecord(version: str, description: str, filename: str, seed_type: str, applied_at: datetime.datetime, checksum: str | None = None) -> None
Declared fields: version, description, filename, seed_type, applied_at, checksum.
SafetyIssue¶
SafetyIssue(severity: str, change_type: str, table_name: str, message: str, column_name: str | None = None, sql: str = '', required_flag: str | None = None) -> None
Declared fields: severity, change_type, table_name, message, column_name, sql, required_flag.
dbwarden.plugin¶
HOOK_CALL_SPECS¶
KNOWN_VALUE_HOOKS¶
MULTI_VALUE_HOOKS¶
PLUGIN_API_ATTR¶
PLUGIN_API_VERSION¶
PLUGIN_CONFIG_KEY_OWNERS¶
PLUGIN_GROUP¶
ConfigKeyRegistry¶
Declared fields: .
Methods declared on this class:
register(key: 'str', *, plugin: 'str') -> 'None'
is_registered(key: 'str') -> 'bool'
owner(key: 'str') -> 'str | None'
keys() -> 'tuple[str, ...]'
reset() -> 'None'
HookConflictError¶
Re-export of dbwarden.exceptions.plugin.HookConflictError.
HookNotRegisteredError¶
Re-export of dbwarden.exceptions.plugin.HookNotRegisteredError.
HookRegistry¶
Declared fields: .
Methods declared on this class:
register(hook_name: 'str', fn: 'Callable[..., Any]', *, plugin: 'str') -> 'None'
execute_single(hook_name: 'str', *args: 'Any', **kwargs: 'Any') -> 'Any'
execute_all(hook_name: 'str', *args: 'Any', **kwargs: 'Any') -> 'list[Any]'
is_registered(hook_name: 'str') -> 'bool'
providers(hook_name: 'str') -> 'list[str]'
hooks() -> 'dict[str, list[tuple[str, Callable[..., Any]]]]'
clear() -> 'None'
ObjectHandlerConflictError¶
Re-export of dbwarden.exceptions.plugin.ObjectHandlerConflictError.
ObjectHandlerRegistration¶
Declared fields: plugin, handler.
ObjectPluginRegistry¶
Declared fields: .
Methods declared on this class:
register_category(name: 'str', *, order: 'int', plugin: 'str') -> 'None'
categories() -> 'dict[str, dict[str, Any]]'
register(handler: 'Any', *, plugin: 'str') -> 'None'
handlers() -> 'dict[str, ObjectHandlerRegistration]'
has_handler(object_type: 'str') -> 'bool'
clear() -> 'None'
PluginApiMismatchError¶
Re-export of dbwarden.exceptions.plugin.PluginApiMismatchError.
PluginRegistrar¶
Methods declared on this class:
register(self, hook_name: 'str', fn: 'Callable[..., Any]') -> 'None'
register_object_handler(self, handler: 'Any') -> 'None'
register_migration_category(self, name: 'str', *, order: 'int') -> 'None'
register_config_key(self, *keys: 'str') -> 'None'
dbwarden.repositories¶
create_migrations_table_if_not_exists¶
fetch_latest_versioned_migration¶
fetch_latest_versioned_migration(db_name: str | None = None) -> dbwarden.models.MigrationRecord | None
get_existing_runs_always_filenames¶
get_existing_runs_on_change_filenames_to_checksums¶
get_latest_versions¶
get_latest_versions(db_name: str | None = None, limit: int | None = None, starting_version: str | None = None) -> list[str]
get_migration_records¶
get_migrated_versions¶
migrations_table_exists¶
run_migration¶
run_migration(sql_statements: list[str], version: str | None, migration_operation: str, filename: str, migration_type: str = 'versioned', db_name: str | None = None, perf: bool = False, connection: Any | None = None, namespace: str = 'default', fencing_token: int = 0, progress_callback: Any | None = None, migration_path: str | None = None, reapply_data: bool = False) -> None
run_repeatable_migration¶
run_repeatable_migration(sql_statements: list[str], filename: str, migration_type: str, db_name: str | None = None, perf: bool = False, connection: Any | None = None) -> None
acquire_lock¶
acquire_lock(db_name: 'str | None' = None, *, namespace: 'str | None' = None, migration_version: 'str | None' = None, migration_checksum: 'str | None' = None) -> 'LockAcquisition'
check_lock¶
create_lock_table_if_not_exists¶
force_release_lock¶
release_lock¶
release_lock(db_name: 'str | None' = None, *, namespace: 'str' = 'default', strategy: 'Any' = None) -> 'bool'
dbwarden.schema¶
DBWardenSeed¶
DBWardenSeed(database: 'str', description: 'str', on_conflict: 'str' = 'ignore', conflict_columns: 'list[str] | None' = None, source_hash: 'str' = '', version: 'str' = '', **kwargs: 'Any') -> 'None'
Declared fields: database, description, on_conflict, conflict_columns, source_hash.
dbwarden.schema.table_meta¶
TableMeta¶
Re-export of dbwarden.schema.table_meta.TableMeta.
PGTableMeta¶
Re-export of dbwarden.schema.table_meta.PGTableMeta.
PGColumnMeta¶
Re-export of dbwarden.schema.table_meta.PGColumnMeta.
PGViewMeta¶
Re-export of dbwarden.schema.table_meta.PGViewMeta.
CHViewMeta¶
Re-export of dbwarden.schema.table_meta.CHViewMeta.
CHTableMeta¶
Re-export of dbwarden.schema.table_meta.CHTableMeta.
CHColumnMeta¶
Re-export of dbwarden.schema.table_meta.CHColumnMeta.
MyTableMeta¶
Re-export of dbwarden.schema.table_meta.MyTableMeta.
MyColumnMeta¶
Re-export of dbwarden.schema.table_meta.MyColumnMeta.
MdbTableMeta¶
Re-export of dbwarden.schema.table_meta.MdbTableMeta.
MdbColumnMeta¶
Re-export of dbwarden.schema.table_meta.MdbColumnMeta.
SqTableMeta¶
Re-export of dbwarden.schema.table_meta.SqTableMeta.
SqColumnMeta¶
Re-export of dbwarden.schema.table_meta.SqColumnMeta.