Are there any examples available for using `dagste...
# announcements
b
Are there any examples available for using
dagster-dbt
? It looks like the library has changed quite a bit since I used it previously. Tx!
d
hey @Basil V 👋 we haven't made any examples public, but I'm more than happy to send over a few examples of how we use it internally
b
That would be awesome! Feel free to DM them or whatever you prefer. Thanks!
👍 1
d
so we run dbt as an RPC server and dagster triggers production dbt processes by communicating with the server. In practice, our pipelines tend to look something like the following:
most of the time, we are triggering some form of data ingestion and/or transformation to happen pre-dbt, and then triggering a number of dbt processes to happen after (sometimes in parallel, as shown above)
we surface all dbt flags via the Dagster UI so that end users can dynamically change the configuration of run as well:
additionally, we surface all dbt logs through the Dagster UI:
b
Thanks for the info. Still trying to wrap my head around it I think. Previously I was just able to plug in my dbt model and run it as a solid. Is there some way to do the equivalent in this new setup?
d
we only really use the RPC solids so I can only speak to that, but we have a single solid
dbt_rpc_run_and_wait
that we alias in a variety of different places to run 1 to n number of models
so the "plugging in" of your dbt model would be equivalent to invoking the
dbt_rpc_run_and_wait
solid with the configuration set to just run your single model
b
Copy code
from dagster_dbt import create_dbt_run_solid

dbt_parse_send_logs = create_dbt_run_solid(
    project_dir='path/to/my_dbt_model/',
    name='dbt_model_name',
)
This is basically what I was doing before
d
oh yeah the way I mentioned above is a more dynamic way of doing what you're doing
the model selection is just configuration on the solid itself
b
So do I have to set up and have dbt running as a separate server now to do the RPC?
d
yeah, RPC requires dbt to be running as a server
but thats just one way to run dbt via Dagster
there is also a
cli
module
(I'm less familiar with that one)
b
Ok I'll check these resources out and will circle back with you if I still end up stuck. Thanks again!
👍 1
b
@Basil V You are right that
dagster-dbt
has changed quite a bit recently. The API docs are a bit terse, so we have diff that is inflight that will add a section on
dagster-dbt
in our examples page with code snippets in GitHub.
b
Thanks!
👍 1
b
as @dwall mentioned, there are solids for the both dbt RPC server and the dbt CLI. in the case of dbt CLI solids, you would pass in CLI options via the solid configs, such as
--project-dir
,
--models
,
--exclude
, etc.