โ10-12-2026 02:03 PM
Hi all,
I'm about to start managing Genie spaces as code with Asset Bundles and wanted
to ask before I build it.
From what I'm reading, the genie_spaces resource needs the tables in its
data_sources to already exist when you deploy. That's fine for an environment
that's already running, but it seems to break the first deploy to a new target,
where the same bundle is creating the schema and tables and then declaring the
Genie space on top of them.
I could split it into two deploys, but then I lose the single command deploy
that's half the point of using bundles.
For anyone already doing this:
Are you keeping the Genie space in the same bundle as the tables it reads, or
did you end up separating them?
And one I haven't found an answer to anywhere: on a redeploy, what happens to
the instructions and example queries people add to the space through the UI?
Does the bundle overwrite them?
Thanks
a month ago
Managing Databricks Genie spaces via Asset Bundles (DABs) introduces a few specific state and dependency challenges, especially around initial provisioning and UI collaboration. Most teams end up separating the Genie space from the underlying data layer. Because the genie_spaces resource validates its data_sources against Unity Catalog at deployment time, a single-bundle deploy will fail on a brand-new target environment where the tables don't exist yet. Keeping data pipeline jobs/tables in a primary data bundle and provisioning the Genie space in a secondary, downstream bundle ensures that all referenced schemas, views, and tables are fully established before the Genie space is declared.
a month ago - last edited a month ago
Hi @juanlozadab ,
To answer your questions separately:
Q1: same bundle or separate? Answer in short: separate
Q2: are UI edits overwritten on redeploy?
a month ago
Short answer: you can keep everything in one bundle and one databricks bundle deploy. Add a job_runs resource that runs the job that builds the tables, and reference that run from the Genie agent so the CLI creates the agent last. On a redeploy the bundle does overwrite instructions and example queries added in the UI, so pull UI edits back with databricks bundle generate genie-space --resource <key> --force before you deploy [1][2].
The Genie agent create call validates the tables in data_sources, so a fresh target fails if the tables don't exist yet. I reproduced it on CLI 1.20.0:
Error: cannot create resources.genie_spaces.probe_space: ... Table 'workspace.mvp_probe.not_created_yet' does not exist. (403 PERMISSION_DENIED)
This shape fixed it in a single deploy. genie_spaces and job_runs both need the direct deployment engine, which is the only engine in CLI 1.20.0 [1][3]:
bundle:
name: sales_genie
engine: direct
resources:
pipelines:
sales_pipeline:
name: sales_pipeline
serverless: true
catalog: workspace
schema: sales
libraries:
- file:
path: ./src/sales.sql
jobs:
build_tables:
name: build_tables
tasks:
- task_key: refresh
pipeline_task:
pipeline_id: ${resources.pipelines.sales_pipeline.id}
job_runs:
seed:
job_id: ${resources.jobs.build_tables.id}
genie_spaces:
sales_agent:
title: Sales agent
description: 'Built after run ${resources.job_runs.seed.run_id}'
warehouse_id: <warehouse-id>
file_path: ./src/sales_agent.geniespace.jsonWhat happened on the first deploy:
The run is recorded in bundle state, so my next deploy didn't re-run it. If you want it to re-run on every deploy, job_runs supports lifecycle.triggers (on_bundle_deploy: true) [1].
I'd still split into two bundles if the table build is slow (the deploy blocks until the run ends) or if another team owns the tables.
They get overwritten. I added a text instruction outside the bundle, which is what a UI edit does. databricks bundle plan then showed update genie_spaces.sales_agent, and after deploy the instruction was gone.
To keep UI work:
databricks bundle generate genie-space --existing-id <space-id> --key sales_agent
databricks bundle generate genie-space --resource sales_agent --force
After a pull, bundle plan can still show an update because the JSON key order differs. The content is the same.
Keep the Genie agent in the same bundle as its pipeline for dev and test targets, with the job_runs seed, and treat the .geniespace.json file in Git as the source of truth. Let people edit in the dev agent, sync with bundle generate genie-space --resource ... --force, and promote to prod only through bundle deploy.
[1] Declarative Automation Bundles resources | Databricks on AWS โ docs.databricks.com/aws/dev-tools/bundles/resources
[2] bundle command group | Databricks on AWS โ docs.databricks.com/aws/dev-tools/cli/bundle-commands
[3] Migrate to the direct deployment engine | Databricks on AWS โ docs.databricks.com/aws/dev-tools/bundles/direct
a month ago
Managing Databricks Genie spaces via Asset Bundles (DABs) introduces a few specific state and dependency challenges, especially around initial provisioning and UI collaboration. Most teams end up separating the Genie space from the underlying data layer. Because the genie_spaces resource validates its data_sources against Unity Catalog at deployment time, a single-bundle deploy will fail on a brand-new target environment where the tables don't exist yet. Keeping data pipeline jobs/tables in a primary data bundle and provisioning the Genie space in a secondary, downstream bundle ensures that all referenced schemas, views, and tables are fully established before the Genie space is declared.
a month ago - last edited a month ago
Hi @juanlozadab ,
To answer your questions separately:
Q1: same bundle or separate? Answer in short: separate
Q2: are UI edits overwritten on redeploy?
a month ago
Short answer: you can keep everything in one bundle and one databricks bundle deploy. Add a job_runs resource that runs the job that builds the tables, and reference that run from the Genie agent so the CLI creates the agent last. On a redeploy the bundle does overwrite instructions and example queries added in the UI, so pull UI edits back with databricks bundle generate genie-space --resource <key> --force before you deploy [1][2].
The Genie agent create call validates the tables in data_sources, so a fresh target fails if the tables don't exist yet. I reproduced it on CLI 1.20.0:
Error: cannot create resources.genie_spaces.probe_space: ... Table 'workspace.mvp_probe.not_created_yet' does not exist. (403 PERMISSION_DENIED)
This shape fixed it in a single deploy. genie_spaces and job_runs both need the direct deployment engine, which is the only engine in CLI 1.20.0 [1][3]:
bundle:
name: sales_genie
engine: direct
resources:
pipelines:
sales_pipeline:
name: sales_pipeline
serverless: true
catalog: workspace
schema: sales
libraries:
- file:
path: ./src/sales.sql
jobs:
build_tables:
name: build_tables
tasks:
- task_key: refresh
pipeline_task:
pipeline_id: ${resources.pipelines.sales_pipeline.id}
job_runs:
seed:
job_id: ${resources.jobs.build_tables.id}
genie_spaces:
sales_agent:
title: Sales agent
description: 'Built after run ${resources.job_runs.seed.run_id}'
warehouse_id: <warehouse-id>
file_path: ./src/sales_agent.geniespace.jsonWhat happened on the first deploy:
The run is recorded in bundle state, so my next deploy didn't re-run it. If you want it to re-run on every deploy, job_runs supports lifecycle.triggers (on_bundle_deploy: true) [1].
I'd still split into two bundles if the table build is slow (the deploy blocks until the run ends) or if another team owns the tables.
They get overwritten. I added a text instruction outside the bundle, which is what a UI edit does. databricks bundle plan then showed update genie_spaces.sales_agent, and after deploy the instruction was gone.
To keep UI work:
databricks bundle generate genie-space --existing-id <space-id> --key sales_agent
databricks bundle generate genie-space --resource sales_agent --force
After a pull, bundle plan can still show an update because the JSON key order differs. The content is the same.
Keep the Genie agent in the same bundle as its pipeline for dev and test targets, with the job_runs seed, and treat the .geniespace.json file in Git as the source of truth. Let people edit in the dev agent, sync with bundle generate genie-space --resource ... --force, and promote to prod only through bundle deploy.
[1] Declarative Automation Bundles resources | Databricks on AWS โ docs.databricks.com/aws/dev-tools/bundles/resources
[2] bundle command group | Databricks on AWS โ docs.databricks.com/aws/dev-tools/cli/bundle-commands
[3] Migrate to the direct deployment engine | Databricks on AWS โ docs.databricks.com/aws/dev-tools/bundles/direct