Skip to content

PostgresSyncedTable

laktory.models.resources.databricks.PostgresSyncedTable ¤

Bases: PostgresSyncedTableBase

Lakebase Autoscaling (Postgres) synced table

Copy of a Unity Catalog Delta table into a Postgres table for low-latency serving, maintained by a managed Lakeflow pipeline. SNAPSHOT scheduling copies the full table on each sync; TRIGGERED and CONTINUOUS are incremental and require Change Data Feed on the source table. The source table must exist when the synced table is created. Can also be declared in the synced_tables of a PostgresBranch, which sets spec.branch.

Examples:

import io

from laktory import models

synced_table_yaml = '''
synced_table_id: app_pg.public.dim_customers
spec:
  branch: projects/app/branches/production
  postgres_database: app_db
  source_table_full_name: prod.gold.dim_customers
  primary_key_columns:
  - customer_id
  scheduling_policy: TRIGGERED
  create_database_objects_if_missing: true
  new_pipeline_spec:
    storage_catalog: prod
    storage_schema: lakebase
'''
synced_table = models.resources.databricks.PostgresSyncedTable.model_validate_yaml(
    io.StringIO(synced_table_yaml)
)
References
BASE DESCRIPTION
provider_config

Configure the provider for management through account provider

TYPE: PostgresSyncedTableProviderConfig | None | VariableType DEFAULT: None

spec

Synced table configuration: source table, Postgres database, branch (set automatically when declared in the synced tables of a branch) and scheduling

TYPE: PostgresSyncedTableSpec | VariableType

synced_table_id

The part of the name, chosen by the user when the resource was created

TYPE: str | VariableType


laktory.models.resources.databricks.postgressyncedtable.PostgresSyncedTableProviderConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
workspace_id

Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with

TYPE: str | None | VariableType DEFAULT: None


laktory.models.resources.databricks.postgressyncedtable.PostgresSyncedTableSpec ¤

Bases: BaseModel

PARAMETER DESCRIPTION
accelerated_sync

When true, enables accelerated sync mode for the initial data load. This significantly improves performance for large tables. Requires workspace-level enablement through Lakebase Accelerated Sync preview

TYPE: bool | None | VariableType DEFAULT: None

branch

The full resource name the branch associated with the table

TYPE: str | None | VariableType DEFAULT: None

create_database_objects_if_missing

If true, the synced table's logical database and schema resources in PG will be created if they do not already exist. The request will fail if this is false and the database/schema do not exist

TYPE: bool | None | VariableType DEFAULT: None

existing_pipeline_id

ID of an existing pipeline to bin-pack this synced table into. At most one of existing_pipeline_id and new_pipeline_spec should be defined

TYPE: str | None | VariableType DEFAULT: None

extra_columns

Extra PostgreSQL-only columns to add to the synced table

TYPE: list[PostgresSyncedTableSpecExtraColumns] | None | VariableType DEFAULT: None

new_pipeline_spec

Specification for creating a new pipeline. At most one of existing_pipeline_id and new_pipeline_spec should be defined

TYPE: PostgresSyncedTableSpecNewPipelineSpec | None | VariableType DEFAULT: None

postgres_database

The Postgres database name where the synced table will be created in

TYPE: str | None | VariableType DEFAULT: None

primary_key_columns

Primary Key columns to be used for data insert/update in the destination

TYPE: list[str] | None | VariableType DEFAULT: None

scheduling_policy

Scheduling policy of the underlying pipeline. Possible values are: CONTINUOUS, SNAPSHOT, TRIGGERED

TYPE: str | None | VariableType DEFAULT: None

source_table_full_name

Three-part (catalog, schema, table) name of the source Delta table

TYPE: str | None | VariableType DEFAULT: None

timeseries_key

Time series key to deduplicate (tie-break) rows with the same primary key

TYPE: str | None | VariableType DEFAULT: None

type_overrides

Override the default Delta->PG type mapping for specific columns. A TypeOverride with PG_SPECIFIC_TYPE_UNSPECIFIED is rejected; a valid pg_type must be set

TYPE: list[PostgresSyncedTableSpecTypeOverrides] | None | VariableType DEFAULT: None


laktory.models.resources.databricks.postgressyncedtable.PostgresSyncedTableSpecExtraColumns ¤

Bases: BaseModel

PARAMETER DESCRIPTION
column_name

Name of the source column whose target PostgreSQL type should be overridden

TYPE: str | VariableType

column_type

PostgreSQL type of the column, for example 'tsvector' or 'vector(1024)'

TYPE: str | VariableType

compute

SQL expression used to compute the column's value, for example 'to_tsvector('english', content)'

TYPE: str | None | VariableType DEFAULT: None

maintenance

Possible values are: STORED_GENERATED

TYPE: str | None | VariableType DEFAULT: None


laktory.models.resources.databricks.postgressyncedtable.PostgresSyncedTableSpecNewPipelineSpec ¤

Bases: BaseModel

PARAMETER DESCRIPTION
budget_policy_id

Budget policy to set on the newly created pipeline

TYPE: str | None | VariableType DEFAULT: None

pipeline_channel

Release channel of the underlying pipeline's runtime. Some source table configurations (e.g., read-time CDF) require PREVIEW. Defaults to CURRENT if not specified. Possible values are: CURRENT, PREVIEW

TYPE: str | None | VariableType DEFAULT: None

storage_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

TYPE: str | None | VariableType DEFAULT: None

storage_schema

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

TYPE: str | None | VariableType DEFAULT: None


laktory.models.resources.databricks.postgressyncedtable.PostgresSyncedTableSpecTypeOverrides ¤

Bases: BaseModel

PARAMETER DESCRIPTION
column_name

Name of the source column whose target PostgreSQL type should be overridden

TYPE: str | VariableType

pg_type

PostgreSQL-specific target type to use for the column. Possible values are: PG_SPECIFIC_TYPE_HALFVEC, PG_SPECIFIC_TYPE_VARCHAR, PG_SPECIFIC_TYPE_VECTOR

TYPE: str | VariableType

size

Size parameter for the target type, for types that take one (e.g. vector dimension, varchar length). Required when the chosen pg_type needs a size

TYPE: int | None | VariableType DEFAULT: None