-
Notifications
You must be signed in to change notification settings - Fork 125
An example of a bundle that creates Lakebase database instance and catalog #99
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
928eb4c
An example of a bundle that creates Lakebase database instance and ca…
anton-107 4069773
mention psql client as a prerequisite for the demo
anton-107 8b7d1b9
fix language, improve readme, mention costs
anton-107 fba5fb5
remove prod block from yaml
anton-107 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # OLTP database instance with a catalog | ||
|
|
||
| This example demonstrates how to define an OLTP database instance and a database catalog in a Databricks Asset Bundle. | ||
|
|
||
| It includes and deploys an example database instance and a catalog. When the instance is making changes to the database, the changes are reflected in Unity Catalog. | ||
|
|
||
| For more information about Databricks database instances, see the [documentation](https://docs.databricks.com/aws/en/oltp/). | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| * Databricks CLI v0.265.0 or above | ||
| * `psql` client version 14 or above (only needed to run the demo data generation) | ||
|
|
||
| ## Usage | ||
|
|
||
| Modify `databricks.yml`: | ||
| * Update the `host` field under `workspace` to the Databricks workspace to deploy to | ||
|
|
||
| Run `databricks bundle deploy` to deploy the bundle. | ||
|
|
||
| Run the following queries to populate your database with sample data: | ||
|
|
||
| - `databricks psql my-instance -- -d my_database -c "CREATE TABLE IF NOT EXISTS hello_world (id SERIAL PRIMARY KEY, message TEXT, number INTEGER, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);"` | ||
| - `databricks psql my-instance -- -d my_database -c "INSERT INTO hello_world (message, number) SELECT 'Hello World #' || generate_series, generate_series FROM generate_series(1, 100);"` | ||
| - `databricks psql my-instance -- -d my_database -c "SELECT * FROM hello_world;"` | ||
|
anton-107 marked this conversation as resolved.
Outdated
|
||
|
|
||
| Open your catalog in Databricks Workspace to explore generated data in Unity Catalog: `databricks bundle open my_catalog` | ||
|
anton-107 marked this conversation as resolved.
Outdated
|
||
| Navigate to `public` schema, then to `hello_world` table, then to "Sample data" | ||
|
anton-107 marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| bundle: | ||
| name: database-catalog-example | ||
|
|
||
| # workspace: | ||
| # host: https://myworkspace.cloud.databricks.com | ||
|
anton-107 marked this conversation as resolved.
|
||
|
|
||
| resources: | ||
| database_instances: | ||
| my_instance: | ||
| name: my-instance | ||
| capacity: CU_1 | ||
| database_catalogs: | ||
| my_catalog: | ||
| database_instance_name: ${resources.database_instances.my_instance.name} | ||
| name: example_catalog | ||
| database_name: my_database | ||
| create_database_if_not_exists: true | ||
|
anton-107 marked this conversation as resolved.
|
||
|
|
||
|
|
||
| # Defines the targets for this bundle. | ||
| # Targets allow you to deploy the same bundle to different Databricks workspaces. | ||
| targets: | ||
| prod: { | ||
| # No overrides | ||
| } | ||
|
anton-107 marked this conversation as resolved.
Outdated
|
||
| dev: | ||
| # This target is for development purposes. | ||
| # It defaults to the current Databricks workspace. | ||
| default: true | ||
| mode: development | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.