Synced Database Tables¶
Package: databricks.bundles.synced_database_tables
Classes¶
- class DependsOn¶
- class Lifecycle¶
- depends_on: list[DependsOn]¶
Resources that must be deployed before this resource and deleted after it. Unlike variable references, this only affects ordering.
- class NewPipelineSpec¶
Custom fields that user can set for pipeline while creating SyncedDatabaseTable. Note that other fields of pipeline are still inferred by table def internally
- storage_catalog: str | None = None¶
[Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog.
UC catalog for the pipeline to store intermediate files (checkpoints, event logs etc). This needs to be a standard catalog where the user has permissions to create Delta tables.
- storage_schema: str | None = None¶
[Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog.
UC schema for the pipeline to store intermediate files (checkpoints, event logs etc). This needs to be in the standard catalog where the user has permissions to create Delta tables.
- class SyncedDatabaseTable¶
A synced table is a Postgres table in a Lakebase database instance that Databricks keeps in sync with a source table in Unity Catalog. A data synchronization pipeline loads the source data and then applies later changes according to the scheduling policy, so the table can serve low-latency queries without a hand-built ETL process. For an overview, see https://docs.databricks.com/aws/en/oltp/projects/sync-tables.
- database_instance_name: str | None = None¶
[Public Preview] Name of the target database instance. This is required when creating synced database tables in standard catalogs. This is optional when creating synced database tables in registered catalogs. If this field is specified when creating synced database tables in registered catalogs, the database instance name MUST match that of the registered catalog (or the request will be rejected).
- lifecycle: Lifecycle | None = None¶
Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed.
- logical_database_name: str | None = None¶
[Public Preview] Target Postgres database object (logical database) name for this table.
When creating a synced table in a registered Postgres catalog, the target Postgres database name is inferred to be that of the registered catalog. If this field is specified in this scenario, the Postgres database name MUST match that of the registered catalog (or the request will be rejected).
When creating a synced table in a standard catalog, this field is required. In this scenario, specifying this field will allow targeting an arbitrary postgres database. If this database does not exist yet, it is created when create_database_objects_if_missing in spec is true.
- spec: SyncedTableSpec | None = None¶
[Public Preview] Specifies the source table, the key columns and how the data synchronization pipeline runs.
- class SyncedTableSchedulingPolicy¶
- CONTINUOUS = 'CONTINUOUS'¶
- TRIGGERED = 'TRIGGERED'¶
- SNAPSHOT = 'SNAPSHOT'¶
- class SyncedTableSpec¶
Specification of a synced database table.
- create_database_objects_if_missing: bool | None = None¶
[Public Preview] If true, the synced table’s logical database and schema resources in PG will be created if they do not already exist. The request fails if this is false and the database or schema does not exist.
- existing_pipeline_id: str | None = None¶
[Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined.
If existing_pipeline_id is defined, the synced table will be bin packed into the existing pipeline referenced. This avoids creating a new pipeline and allows sharing existing compute. In this case, the scheduling_policy of this synced table must match the scheduling policy of the existing pipeline.
- new_pipeline_spec: NewPipelineSpec | None = None¶
[Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined.
If new_pipeline_spec is defined, a new pipeline is created for this synced table. The location pointed to is used to store intermediate files (checkpoints, event logs etc). The caller must have write permissions to create Delta tables in the specified catalog and schema. Again, note this requires write permissions, whereas the source table only requires read permissions.
- primary_key_columns: list[str]¶
[Public Preview] The primary key columns are used to insert and update rows in the destination table. At least one column is required. Rows whose primary key columns contain null values are not synced, and the primary key cannot be changed after the table is created.
- scheduling_policy: SyncedTableSchedulingPolicy | None = None¶
[Public Preview] Specifies the scheduling policy of the underlying pipeline. With CONTINUOUS, the pipeline keeps running and applies source changes as they happen. With TRIGGERED and SNAPSHOT, the pipeline stops after the initial load and syncs again only when it is run (manually, on a schedule or from a job); TRIGGERED applies source changes incrementally, while SNAPSHOT copies the full source table on every run. CONTINUOUS and TRIGGERED require the source table to provide a change data feed.
- source_table_full_name: str | None = None¶
[Public Preview] Three-part (catalog, schema, table) name of the source Delta table.
- timeseries_key: str | None = None¶
[Public Preview] The time series key deduplicates (tie-breaks) rows with the same primary key. When primary key values can repeat in the source table, the synced table keeps only the row with the latest value of this column for each primary key. The key cannot be changed after the table is created.