-
Notifications
You must be signed in to change notification settings - Fork 195
Add postgres_catalogs bundle resource #5265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
3857f0f
bbbf49f
647bd80
3ce34dd
0ecbfab
b598a3d
37c8070
d2bac89
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| bundle: | ||
| name: test-bundle-$UNIQUE_NAME | ||
|
|
||
| resources: | ||
| postgres_projects: | ||
| project: | ||
| project_id: test-pg-project-$UNIQUE_NAME | ||
| display_name: Test Postgres Project | ||
|
|
||
| postgres_catalogs: | ||
| catalog: | ||
| catalog_id: test_pg_catalog_$UNIQUE_NAME | ||
| branch: ${resources.postgres_projects.project.name}/branches/production | ||
| postgres_database: appdb | ||
| create_database_if_missing: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| bundle: | ||
| name: deploy-postgres-catalog-$UNIQUE_NAME | ||
|
|
||
| sync: | ||
| paths: [] | ||
|
|
||
| resources: | ||
| postgres_projects: | ||
| my_project: | ||
| project_id: test-pg-proj-$UNIQUE_NAME | ||
| display_name: "Test Project for Catalog" | ||
| pg_version: 16 | ||
|
|
||
| postgres_catalogs: | ||
| my_catalog: | ||
| catalog_id: lakebase_test_$UNIQUE_NAME | ||
| branch: ${resources.postgres_projects.my_project.id}/branches/production | ||
| postgres_database: appdb | ||
| create_database_if_missing: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/postgres/projects", | ||
| "q": { | ||
| "project_id": "test-pg-proj-[UNIQUE_NAME]" | ||
| }, | ||
| "body": { | ||
| "spec": { | ||
| "display_name": "Test Project for Catalog", | ||
| "pg_version": 16 | ||
| } | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/postgres/catalogs", | ||
| "q": { | ||
| "catalog_id": "lakebase_test_[UNIQUE_NAME]" | ||
| }, | ||
| "body": { | ||
| "spec": { | ||
| "branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production", | ||
| "create_database_if_missing": true, | ||
| "postgres_database": "appdb" | ||
| } | ||
| } | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.0/postgres/catalogs/lakebase_test_[UNIQUE_NAME]" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
|
pietern marked this conversation as resolved.
Outdated
|
||
| "method": "POST", | ||
| "path": "/api/2.0/postgres/projects", | ||
| "q": { | ||
| "project_id": "test-pg-proj-[UNIQUE_NAME]" | ||
| }, | ||
| "body": { | ||
| "spec": { | ||
| "display_name": "Test Project for Catalog", | ||
| "pg_version": 16 | ||
| } | ||
| } | ||
| } | ||
| { | ||
| "method": "POST", | ||
| "path": "/api/2.0/postgres/catalogs", | ||
| "q": { | ||
| "catalog_id": "lakebase_test_[UNIQUE_NAME]" | ||
| }, | ||
| "body": { | ||
| "spec": { | ||
| "branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production", | ||
| "create_database_if_missing": true, | ||
| "postgres_database": "appdb" | ||
| } | ||
| } | ||
| } | ||
| { | ||
| "method": "GET", | ||
| "path": "/api/2.0/postgres/catalogs/lakebase_test_[UNIQUE_NAME]" | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
|
|
||
| >>> [CLI] bundle validate | ||
| Name: deploy-postgres-catalog-[UNIQUE_NAME] | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default | ||
|
|
||
| Validation OK! | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: deploy-postgres-catalog-[UNIQUE_NAME] | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default | ||
| Resources: | ||
| Postgres catalogs: | ||
| my_catalog: | ||
| Name: lakebase_test_[UNIQUE_NAME] | ||
| URL: [DATABRICKS_URL]/explore/data/lakebase_test_[UNIQUE_NAME] | ||
| Postgres projects: | ||
| my_project: | ||
| Name: Test Project for Catalog | ||
| URL: (not deployed) | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] postgres get-catalog catalogs/lakebase_test_[UNIQUE_NAME] | ||
| { | ||
| "name": "catalogs/lakebase_test_[UNIQUE_NAME]", | ||
| "status": { | ||
| "branch": "projects/test-pg-proj-[UNIQUE_NAME]/branches/production", | ||
| "catalog_id": "lakebase_test_[UNIQUE_NAME]", | ||
| "postgres_database": "appdb", | ||
| "project": "projects/test-pg-proj-[UNIQUE_NAME]" | ||
| } | ||
| } | ||
|
|
||
| >>> [CLI] bundle summary | ||
| Name: deploy-postgres-catalog-[UNIQUE_NAME] | ||
| Target: default | ||
| Workspace: | ||
| User: [USERNAME] | ||
| Path: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default | ||
| Resources: | ||
| Postgres catalogs: | ||
| my_catalog: | ||
| Name: lakebase_test_[UNIQUE_NAME] | ||
| URL: [DATABRICKS_URL]/explore/data/lakebase_test_[UNIQUE_NAME] | ||
| Postgres projects: | ||
| my_project: | ||
| Name: Test Project for Catalog | ||
| URL: (not deployed) | ||
|
|
||
| >>> print_requests.py --keep --get //postgres ^//workspace-files/ ^//workspace/ ^//telemetry-ext ^//operations/ | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.postgres_catalogs.my_catalog | ||
| delete resources.postgres_projects.my_project | ||
|
|
||
| This action will result in the deletion of the following Lakebase projects along with | ||
| all their branches, databases, and endpoints. All data stored in them will be permanently lost: | ||
| delete resources.postgres_projects.my_project | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/deploy-postgres-catalog-[UNIQUE_NAME]/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
|
|
||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| trace $CLI bundle validate | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| rm -f out.requests.txt | ||
| trace $CLI bundle deploy | ||
|
|
||
| # Get catalog details. Hide volatile fields so cloud and local match. | ||
| catalog_name="catalogs/lakebase_test_${UNIQUE_NAME}" | ||
| trace $CLI postgres get-catalog "${catalog_name}" | jq 'del(.create_time, .update_time, .uid)' | ||
|
|
||
| trace $CLI bundle summary | ||
|
|
||
| # Filter requests to only show postgres operations (exclude workspace, telemetry, and operation polling). | ||
| trace print_requests.py --keep --get '//postgres' '^//workspace-files/' '^//workspace/' '^//telemetry-ext' '^//operations/' > out.requests.$DATABRICKS_BUNDLE_ENGINE.json |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| bundle: | ||
| name: recreate-postgres-catalog-$UNIQUE_NAME | ||
|
|
||
| sync: | ||
| paths: [] | ||
|
|
||
| resources: | ||
| postgres_projects: | ||
| my_project: | ||
| project_id: test-pg-proj-$UNIQUE_NAME | ||
| display_name: "Test Project for Catalog Recreate" | ||
| pg_version: 16 | ||
|
|
||
| postgres_catalogs: | ||
| my_catalog: | ||
| catalog_id: lakebase_test_$UNIQUE_NAME | ||
| branch: ${resources.postgres_projects.my_project.id}/branches/production | ||
| postgres_database: $POSTGRES_DATABASE | ||
| create_database_if_missing: true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-catalog-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] bundle plan | ||
| recreate postgres_catalogs.my_catalog | ||
|
|
||
| Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged | ||
|
|
||
| >>> [CLI] bundle deploy | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-catalog-[UNIQUE_NAME]/default/files... | ||
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
|
|
||
| >>> [CLI] bundle destroy --auto-approve | ||
| The following resources will be deleted: | ||
| delete resources.postgres_catalogs.my_catalog | ||
| delete resources.postgres_projects.my_project | ||
|
|
||
| This action will result in the deletion of the following Lakebase projects along with | ||
| all their branches, databases, and endpoints. All data stored in them will be permanently lost: | ||
| delete resources.postgres_projects.my_project | ||
|
|
||
| All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/recreate-postgres-catalog-[UNIQUE_NAME]/default | ||
|
|
||
| Deleting files... | ||
| Destroy complete! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| cleanup() { | ||
| trace $CLI bundle destroy --auto-approve | ||
| rm -f out.requests.txt | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| export POSTGRES_DATABASE=appdb | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| trace $CLI bundle deploy | ||
|
|
||
| # Toggle a recreate-on-change field; plan must show delete + create. | ||
| export POSTGRES_DATABASE=otherdb | ||
| envsubst < databricks.yml.tmpl > databricks.yml | ||
| trace $CLI bundle plan | contains.py "Plan: 1 to add, 0 to change, 1 to delete, 1 unchanged" | ||
|
|
||
| trace $CLI bundle deploy |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| Local = true | ||
| Cloud = true | ||
| RequiresUnityCatalog = true | ||
|
|
||
| # Lakebase v2 (postgres) is only available in AWS as of January 2026 | ||
| CloudEnvs.gcp = false | ||
| CloudEnvs.azure = false | ||
|
|
||
| EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct", "terraform"] | ||
|
|
||
| Ignore = [ | ||
| "databricks.yml", | ||
| ".databricks", | ||
| ] | ||
|
|
||
| [[Repls]] | ||
| # Clean up ?o=<num> suffix after URL since not all workspaces have that | ||
| Old = '\?o=\[(NUMID|ALPHANUMID)\]' | ||
| New = '' | ||
| Order = 1000 | ||
|
|
||
| [[Repls]] | ||
| # Normalize postgres operation IDs (unique per operation). | ||
| Old = '/operations/[A-Za-z0-9+/=-]+' | ||
| New = '/operations/[OPERATION_ID]' | ||
| Order = 2000 |
Uh oh!
There was an error while loading. Please reload this page.