with the new @dbt_assets, is there a way to define...
# integration-dbt
d
with the new @dbt_assets, is there a way to define key_prefix in the dbt-project itself? currently in dagster my dbt assets are all in a flat asset list. I would like to put them in a asset folder like before with the key_prefix.
dagster bot responded by community 1
t
Hi @Daniel, have a look at this example.
If you would like to define it in the project itself, you could use dbt metadatas.
d
thanks, @Timothee Vandeput ! I already tried with dbt metadata but couldn‘t find the proper way. What would be the right key to define this? with dagster: group: „mykey“ it only used this for dagster groups. Couldn‘t find documentation on the possible metadata keys?! also seems like metadata need to be defined per table and dagster doesn‘t read global ones (at least with groups)
t
We defined our groups once for multiples models in our
dbt_project.yml
. Have a look at this conversation. We also change our key prefix by overriding
get_asset_key
method of
DagsterDbtTranslator
as shown in the example I posted above. If you set a metadata in your dbt project, you can access it with
node_info.get("meta", {}).get("dagster", {})
in the
get_asset_key
method.