PostgresBranch
laktory.models.resources.databricks.PostgresBranch
¤
Bases: PostgresBranchBase
Lakebase Autoscaling (Postgres) Branch
Isolated, copy-on-write version of the data of a project (e.g. production,
development, a feature branch), with its own endpoints, databases and
roles. A production branch is created implicitly with each project: set
replace_existing: true to manage it. Can also be declared in the
branches of a PostgresProject.
Lakebase Autoscaling resources don't detect changes made outside
Terraform, and a value removed from spec is kept by the server.
Examples:
import io
from laktory import models
branch_yaml = '''
parent: projects/app
branch_id: production
replace_existing: true
spec:
no_expiry: true
endpoints:
- endpoint_id: primary
replace_existing: true
spec:
endpoint_type: ENDPOINT_TYPE_READ_WRITE
autoscaling_limit_min_cu: 0.5
autoscaling_limit_max_cu: 4.0
catalogs:
- catalog_id: app_pg
spec:
postgres_database: app_db
create_database_if_missing: true
synced_tables:
- synced_table_id: app_pg.public.dim_customers
spec:
postgres_database: app_db
source_table_full_name: prod.gold.dim_customers
primary_key_columns:
- customer_id
scheduling_policy: SNAPSHOT
new_pipeline_spec:
storage_catalog: prod
storage_schema: lakebase
snapshot_schedule:
schedule:
- daily_schedule:
hour: 3
retention: 168h0m0s
'''
branch = models.resources.databricks.PostgresBranch.model_validate_yaml(
io.StringIO(branch_yaml)
)
| BASE | DESCRIPTION |
|---|---|
branch_id
|
Part of the resource name
TYPE:
|
parent
|
Project of the branch (
TYPE:
|
provider_config
|
Configure the provider for management through account provider
TYPE:
|
purge_on_delete
|
If true, permanently delete the branch; if false, soft delete
TYPE:
|
replace_existing
|
If true, update the branch if it already exists instead of returning an error
TYPE:
|
spec
|
The spec contains the branch configuration
TYPE:
|
| LAKTORY | DESCRIPTION |
|---|---|
catalogs
|
Unity Catalog catalogs registering databases of the branch. Their
TYPE:
|
databases
|
Databases of the branch. Their
TYPE:
|
endpoints
|
Endpoints (compute) of the branch. Their
TYPE:
|
roles
|
Roles of the branch. Their
TYPE:
|
snapshot_schedule
|
Snapshot schedule of the branch. Its
TYPE:
|
synced_tables
|
Unity Catalog tables synced into databases of the branch. Their
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
assign_parents |
Set the branch path on nested resources |
| ATTRIBUTE | DESCRIPTION |
|---|---|
additional_core_resources |
TYPE:
|
path |
Lakebase resource path
TYPE:
|
additional_core_resources
property
¤
- endpoints
- roles
- databases
- snapshot schedule
- catalogs
- synced tables
Siblings reference each other by name only (database owner role, catalog and synced table Postgres database), so they are created in that order: roles, databases, catalogs, synced tables.
path
property
¤
Lakebase resource path {project path}/branches/{branch_id}
assign_parents()
¤
Set the branch path on nested resources
Source code in laktory/models/resources/databricks/postgresbranch.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
laktory.models.resources.databricks.postgresbranch.PostgresBranchProviderConfig
¤
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:
|
laktory.models.resources.databricks.postgresbranch.PostgresBranchSpec
¤
Bases: BaseModel
| PARAMETER | DESCRIPTION |
|---|---|
expire_time
|
Absolute expiration time for the branch. Empty if expiration is disabled
TYPE:
|
is_protected
|
Whether the branch is protected
TYPE:
|
no_expiry
|
Explicitly disable expiration. When set to true, the branch will not expire. If set to false, the request is invalid; provide either ttl or expire_time instead. Mutually exclusive with
TYPE:
|
source_branch
|
The name of the source branch from which this branch was created. Format: projects/{project_id}/branches/{branch_id}
TYPE:
|
source_branch_lsn
|
The Log Sequence Number (LSN) on the source branch from which this branch was created
TYPE:
|
source_branch_time
|
The point in time on the source branch from which this branch was created
TYPE:
|
source_snapshot
|
The snapshot this branch was restored from. Set only for branches created by restoring a snapshot; unset for all other branches. Format: projects/{project_id}/snapshots/{snapshot_id}
TYPE:
|
ttl
|
Relative time-to-live duration. When set, the branch will expire at creation_time + ttl. Mutually exclusive with
TYPE:
|