You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create snapshot tables in an external location #372
A clear and concise description of what you want to happen.
In the non-snapshot models we have a config parameter location_root that we can leverage to create external tables. Issue is when we pass the parameter in snapshots it doesn't work. DBT still creates the model in the schema location.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Please include any other relevant context here.
Who will this benefit?
What kind of use case will this feature be useful for? Please be specific and provide examples, this will help us prioritize properly.
Are you interested in contributing this feature?
Let us know if you want to write some code, and how we can help.
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.
We are on 1.10.14 and the location_root parameter for snapshot is working for us.
(We are defining it in a project.yml and not in the "config" part of models)
Following up on @karasda's report that this works on 1.10.14 — the code path on main supports it.
Snapshots build their table through create_table_as (materializations/snapshot.sql), which resolves to databricks__create_table_as in relations/table/create.sql, and that emits location_clause(catalog_relation) alongside the other clauses. The catalog relation gets its location from parse_model.location_root(model), which reads location_root off any node's config — it is not model-specific — and joins it with the identifier path:
Only the initial snapshot build goes through create_table_as; later runs merge into the existing table, so the location is set once at creation as expected.
One gap worth noting: there is no functional test pinning this. grep -rn "location_root" tests/functional/ only turns up incremental, seed, persist_docs, and python-model cases — nothing for snapshots — so the behavior is currently unprotected against regression even though it works.
Caveat: I verified the code path and clause construction, not an end-to-end run against a workspace with a real external location. If a maintainer can confirm, this looks closeable (optionally with a snapshot case added to the location_root coverage first).
This is supported. We tested on current main (1.12.7) with location_root set both under snapshots: in dbt_project.yml and in the snapshot's own config(). In both cases the snapshot table is created as an EXTERNAL table under <location_root>/<snapshot name>, and a second dbt snapshot after a source change keeps it there and records the change. As @karasda noted, this already worked on 1.10.14. Closing as completed; please reopen with your config and dbt.log if it doesn't work for you.
Activity
github-actions commentedon Dec 19, 2023
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.
karasda commentedon Dec 19, 2025
We are on 1.10.14 and the location_root parameter for snapshot is working for us.
(We are defining it in a project.yml and not in the "config" part of models)
TangoEnSkai commentedon Aug 23, 2026
Following up on @karasda's report that this works on 1.10.14 — the code path on
mainsupports it.Snapshots build their table through
create_table_as(materializations/snapshot.sql), which resolves todatabricks__create_table_asinrelations/table/create.sql, and that emitslocation_clause(catalog_relation)alongside the other clauses. The catalog relation gets its location fromparse_model.location_root(model), which readslocation_rootoff any node's config — it is not model-specific — and joins it with the identifier path:Only the initial snapshot build goes through
create_table_as; later runs merge into the existing table, so the location is set once at creation as expected.One gap worth noting: there is no functional test pinning this.
grep -rn "location_root" tests/functional/only turns up incremental, seed, persist_docs, and python-model cases — nothing for snapshots — so the behavior is currently unprotected against regression even though it works.Caveat: I verified the code path and clause construction, not an end-to-end run against a workspace with a real external location. If a maintainer can confirm, this looks closeable (optionally with a snapshot case added to the
location_rootcoverage first).sd-db commentedon Oct 24, 2026
This is supported. We tested on current
main(1.12.7) withlocation_rootset both undersnapshots:indbt_project.ymland in the snapshot's ownconfig(). In both cases the snapshot table is created as an EXTERNAL table under<location_root>/<snapshot name>, and a seconddbt snapshotafter a source change keeps it there and records the change. As @karasda noted, this already worked on 1.10.14. Closing as completed; please reopen with your config anddbt.logif it doesn't work for you.