Skip to content

Genie Space bundle resource requires its source table to exist at deploy time, blocking first-time bundle deploys #6750

Open

Description

@iamsimran

Describe the issue

Deploying a Databricks Asset Bundle that declares a genie_spaces resource in YAML requires the underlying data source (schema/table) referenced in data_sources.tables to already exist in the target workspace at deploy time. This makes it impossible to deploy a bundle end-to-end on a fresh environment (e.g. a new feature-branch target) where the schema and tables are created by the same deployment and do not exist yet - the deployment fails outright.

This enforcement is inconsistent with the rest of the table's lifecycle: once a Genie Space has been created against a table, Unity Catalog does not block dropping that table even though a Genie Space still references it. The Genie Space is left pointing at a source that no longer exists (surfaced only as a UI warning on the agent page), which should not be possible if the CLI/platform is going to enforce the reverse direction (source-must-exist-before-agent-creation) so strictly.

We want CLI to be able to create the Genie Space even if the source doesn't exist at the time pf deployment so a clean deployment can happen when a Genie Space resource exist in the bundle or make these two enforcement points to be symmetric: if Databricks is going to require the source to exist before a Genie Space can reference it, it should equally block deleting/dropping that source while a Genie Space still references it.

Notably, databricks bundle destroy already handles this correctly: it tears down the Genie Space and the schema/tables together as part of the same bundle teardown, with no errors. It's only the two independent, out-of-band actions - bundle deploy (create) and DROP TABLE/DROP SCHEMA (delete) - that are inconsistent with each other.

Configuration

Sanitised relevant bundle resource configuration (real shape from our repo, genie_spaces resource type):

resources:
  genie_spaces:
    iris_genie_space:
      title: ${var.workflow_prefix}ABC Genie Space
      description: |
        ...
      warehouse_id: ${var.sp_warehouse_id}
      serialized_space:
        version: 2
        config:
          data_sources:
            tables:
              - identifier: ${var.catalog}.${var.schema_prefix}refined_source.bac_123
          instructions:
            text_instructions:
              - content:
                  - |-
                    ...

The bundle provisions an isolated Unity Catalog schema per Git branch/feature deployment (via catalog / schema_prefix bundle variables), and other resources in the same bundle (jobs/pipelines) create the schema and populate refined_source.bac_123 as part of the same databricks bundle deploy via a job_runs resource.

Steps to reproduce the behavior

  1. Define a genie_spaces resource in a bundle's databricks.yml, with data_sources.tables referencing a table created by another resource (job/pipeline) in the same bundle.
  2. Deploy the bundle for the first time against a brand-new target/branch where the schema and table do not yet exist (e.g. databricks bundle deploy -t feature_branch --var="branch_name=<new_branch>").
  3. Observe the deployment fails because the Genie Space cannot be created/validated against a non-existent source table. (screenshot below)
  4. As a separate step, deploy the bundle again (or redeploy just the Genie Space resource) after the schema/table has been created by a prior successful run — the Genie Space now deploys successfully.
  5. Run DROP TABLE <catalog>.<schema_prefix>refined_source.bac_123 (or drop the schema) directly, while the Genie Space above still references it.
  6. Observe the drop succeeds with no error/warning at drop time, even though a live Genie Space references the table. The Genie Space itself is not removed, disabled, or blocked from continuing to exist.

Expected Behavior

Enforcement of the source ↔ Genie Space coupling should be symmetric. Concretely, we'd like:

  • Allow the genie_spaces bundle resource to deploy successfully even when the referenced source table does not yet exist, deferring the "source missing" state to the existing UI-level warning shown on the Genie Space page (i.e. the same warning that already appears today after a table is dropped post-creation).

If that referential-integrity enforcement isn't desired on the create side, then the correct fix is to relax the drop side instead, since databricks bundle destroy already proves the CLI is capable of managing both together:

  • DROP TABLE / DROP SCHEMA to be blocked (or require an explicit override, similar to how Unity Catalog already blocks dropping objects that have dependent views/constraints) when a Genie Space still lists that table in data_sources.tables - mirroring the same strictness the CLI already applies at Genie Space creation time.

Either fix removes the current asymmetry; preferably creation of Genie Space without source's existence is needed.

Actual Behavior

  • First-time deployment of a bundle containing a genie_spaces resource fails outright when the referenced table does not already exist, blocking a clean, single-pass bundle deploy for new branches/environments.
  • DROP TABLE/DROP SCHEMA succeeds with no check for, or warning about, Genie Spaces that reference the object being dropped, even though the CLI enforces the opposite dependency direction at deploy time.
  • databricks bundle destroy is the one place this is handled correctly - it removes the Genie Space and its source schema/tables together, with no ordering errors.

Why the usual workaround is unsuitable

The only workaround is to split the deployment into two manual passes: first deploy everything except the genie_spaces resource so the schema/table is created, then deploy again (or deploy the Genie Space resource in isolation) once the source exists. This defeats the purpose of a single declarative bundle deployment and is not viable for CI/CD pipelines that deploy an entire bundle atomically per branch (our case: jobs, schemas/tables + Genie Space are meant to be provisioned together for each feature branch). It also does nothing to address the reverse gap — nothing stops a later DROP TABLE from silently orphaning the Genie Space's reference.

OS and CLI version

  • OS / CI runner: Linux
  • Databricks CLI version: 1.15.0
  • Still reproducible with latest CLI: yes

Is this a regression?

No

Debug Logs

Output from a databricks bundle deploy command where the bundle has a genie_space resource without the underlying data source in existence.
Image

Below is the screenshot from a Genie Agent that exist after the underlying data source was dropped.

Image

Additional Context

We provision an isolated Unity Catalog schema per Git branch/feature deployment (via bundle variables), and a Genie Space is intended to be created against that schema as part of the same bundle deployment. Because the Genie Space resource cannot be created before its source table exists, every new branch's first deployment fails, forcing us to either exclude the Genie Space resource from new-branch deployments or accept a broken first deploy. Since databricks bundle destroy already proves the platform can coordinate deletion of a Genie Space and its source together, we'd like that same coordination applied consistently - either by relaxing the create-time requirement to match how loosely the two are actually coupled after creation, or by blocking the drop of a referenced source.

Activity

  1. barryjpodonovan commented on Sep 23, 2026

    @barryjpodonovan

    This behaviour breaks the whole DAB model of deploying resources and then running jobs (hence the recent addition of the job_run resource type). Splitting into multiple DABs and orchestrating deployments is an awful workaround.

    Even this Databricks Community Technical Blog post on Managing Databricks Genie Agents as Code with Databricks Declarative Automation Bundles (DAB) seems to skirt the issue by assuming the Genie Agent/Space already exists in the workspace...

  2. barryjpodonovan commented on Oct 18, 2026

    @barryjpodonovan

    @denik @andrewnester -- Surely this needs to be addressed?

    If the idea is to have a bubble be the way infra is stood up, having resources that are impossible to deploy in a new workspace or schema surely defeats the purpose.

    And splitting resource over multiple bundles is very messy if you are a team developing BOTH the dataset AND the Genie Space.

    This is especially significant if you create a feature branch which spins up new schemas through the DAB

  3. wright-w commented on Oct 27, 2026

    @wright-w

    Are there any plans to resolve this via some sort of "warn instead of fail deploy" feature, or even an --exclude tag of some kind? It's annoying that building a single genie agent into a DAB therefore breaks the whole personal deploy workflow, because you can no longer deploy the bundle from scratch if needed.

  4. barryjpodonovan commented on Oct 27, 2026

    @barryjpodonovan

    That is another good use case. In all my contact with Databricks, I have been told to put the spaces in a separate DAB, which makes no sense to me

  5. wright-w commented on Oct 28, 2026

    @wright-w

    @barryjpodonovan I just opened a PR for some tweaks that fix this issue entirely. I made it so there's an opt-in flag on *.genie-space.yml files, which when set to true, checks if data sources exist, and if they don't, deploys the genie space without them attached. Future deploys do the same check, and as soon as a data source exists, it is attached.

    Fingers crossed the PR gets approved!

  6. barryjpodonovan commented on Oct 28, 2026

    @barryjpodonovan

    I'm not sure that fully solves the issue, as you'd still have to deploy multiple times. If you merged a change to main branch with a new space and source tables, and a GitHub action ran to deploy the bundle and another action to run whatever jobs need to be run, you'd have to deploy the bundle again at the end to deploy the space.

    If you are using bundles in the ui, you'd be doing a confusing manual process of deploy, run job, deploy again.

    Fundamentally, the api shouldn't be checking if the source exists at all, it shouldn't just be deploying the space. If your PR opts out of checking for source existence, and just deploys the space anyway, that would be ideal.

  7. wright-w commented on Oct 28, 2026

    @wright-w

    @barryjpodonovan I 100% agree. A change to the Genie-space API would be a better solution, I can't code that up unfortunately! So for the time being, this is, in my book, an acceptable stopgap (even if it requires the occasional deploy to be run twice).

  8. andrewnester commented on Oct 28, 2026

    @andrewnester
    Contributor

    @barryjpodonovan we are adding a new feature - depends_on (#7120) - available for all resources. Considering this, would it be an option:

    1. Genie space resource defines depends_on section which depends on job_run resource
    2. In bundle you define job_run resource which is responsible to create required tables
    3. job_run resource depends_on schemas defined in bundle

    Thus, Genie space won't be created until job run creates all required tables

  9. wright-w commented on Oct 28, 2026

    @wright-w

    @andrewnester that depends_on update won't really fix this issue entirely. While it's great that we would be able to define dependencies for a Genie space, that's only a bandaid. Ideally Genie spaces should act just like Dashboards, in that they can be deployed successfully, even if the UC objects they’re dependent on don’t exist. There's no reason a Genie space should be prevented from being deployed when its data sources don’t exist, it just shouldn't be useable until this data sources exist, just like how Databricks Dashboards work. That of course is not a CLI change but a Genie Space API change, to bring it in line with the Lakeflow API that's used for dashboards. Just my thoughts on the matter.

  10. barryjpodonovan commented on Oct 28, 2026

    @barryjpodonovan

    The depends on feature is useful, but if the job_run takes more than a minute or two to run, then it will hold the deployment (and the GitHub runner) for the duration of the job run which is a bad experience. If the run takes longer than any time-out threshold, then the space never gets deployed.

    Fully agree with @wright-w that the behaviour should mirror dashboards.

    I acknowledge that api changes might be harder, but if the table source of an existing space can be dropped (and the space displays and error) then a space should be able to be created without the source table existing either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DABsDABs related issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions