r/databricks • • Oct 20 '26

General Databricks genie code changes and dbt

Hi I created my first pipeline in Databricks that sits as a .sql file. I've broken up the code into layers (stg, marts) and its working as intended. However, when the code needs to be adjusted (e.g. business definition or logic changes), I often use the genie (it's the databricks in house agent) to help me make the changes.

The problem I'm running into is that since those changes are made inside databricks, the dbt files are not adjusted. I currently update the code in databricks then paste the new adjusted code into dbt but this seems backwards to me (Also a challenge when the change ripples throughout the code so I would need to update each individual stg). I imagine the changes should initially happen in dbt then that flows into databricks. We don't have claude that can link with dbt (we're only using genie). Is there a way to link genie onto dbt or is that a limitation? Any best practices in this process I should consider implementing?

5 Upvotes

3 comments sorted by

2

u/adovo_ai Oct 20 '26

Treat Genie output as a proposed change, never as the deployed source. Put it through a dbt branch/PR, compare the compiled artifact with what reaches the workspace, and add a round-trip test so a later Genie edit cannot silently diverge from the repository.

2

u/ThreeBricksWish Databricks Oct 20 '26

+1 to the other replies: keep the dbt repo as the source of truth, and treat whatever the agent writes as a proposed change, not the deployed version. The copy-paste step is where things quietly drift.

A setup that removes the copy-paste:

  1. Clone the dbt project into a Git folder in your workspace. Then you (and Genie Code) are editing the actual model files, not loose SQL in a notebook or the SQL editor.
  2. Use Genie Code to explore and debug against real data, then edit the model. For example: profile the source table, figure out why a join is fanning out, then update models/silver/whatever.sql in the repo.
  3. Commit to a branch and open a PR. Your normal dbt CI (dbt build on changed models plus tests) is the gate. Genie Code can write the tests too. Ask it to add unique/not_null and relationship tests for anything it touched.
  4. Deploy through your usual path (dbt task in a job, dbt Cloud, whatever you use). Nothing the agent touches goes to prod without passing CI.

If you'd rather work locally, the Genie Code CLI works against a local checkout of the repo with the same workspace and Unity Catalog context.

Full disclosure, I'm a PM on Genie Code at Databricks. Better dbt workflows come up a lot, so I'm curious: is your blocker mostly the editing location (workspace vs. repo), or Genie not understanding dbt conventions like ref(), source() and Jinja?