https://prefect.io logo
a

Andrew Black

02/18/2022, 2:01 PM
Re:dbt features — Hi everyone, I look after Prefect’s partnerships and we're collaborating with dbt on what we should enable together. What would you like to see?
dbt 4
upvote 2
n

Noah Holm

02/18/2022, 2:29 PM
Hey Andrew, would you say this is mostly about (verified) Prefect tasks or could there be other things that entails the partnerships? I’m not really hinting to some idea, just interesting to see what you think the partnerships entail as most of what I’ve understood and seen are Prefect tasks.
👀 1
j

Jared Noynaert

02/21/2022, 6:58 AM
Two function gaps today using Prefect + dbt. No promises about how relevant they are to the typical Prefect+dbt user, though: 1. Separated lineage a. The "run" node is just a single task with a lot of logs--you're going to be headed to your dbt docs to figure out the impact of a failure, or to dbt cloud/your logs/your hacky custom viz to figure out execution time bottlenecks b. We intentionally push things into Prefect that don't have to live there so that it can serve as an observability layer, yet have poor-ish visibility into dbt from Prefect c. Dagster's new support for this in 0.14 looks really appealing so there is a bit of a competitive aspect here (their approach to data-aware tasks is much more general, but dbt is going to be the flagship example for that feature for a long time) 2. Inserting tasks into the dbt DAG An example of a feature that could help with separated lineage would be importing dbt run details as a subgraph during or after a run. Another option might be improved post-run artifacts--as a truly minimal example, just having a graphviz of the dbt dag with timings and node status might be helpful (or a snapshot/summary + clickthrough to dbt cloud, once they support better vis and reporting around this). For the second one, I'm not sure what a good solution looks like, but the basic problem is when people want to do this: 1. Run part of your dbt DAG 2. Execute some code that modifies assets in your DWH (e.g. run a scoring model and upload the results, execute something in Snowpark) 3. Run the downstream parts of your DAG You can handle that today by using node selectors in different task steps, but it feels clunky. I think this use case will get more common with Snowpark and serverless Spark on BigQuery, and while the endgame for those specific scenarios is dbt supporting things like Snowpark, that could be a while. You might conclude that (upcoming) Python UDF support and external functions don't leave much of a sweet spot to focus on here but it's worth investigation.
🙌 1
n

Noah Holm

02/21/2022, 7:46 AM
We don’t use dbt cloud so we use the shelltask and I think it’s great in that it gives a lot of flexibility with the “give whatever shell command to run”. I guess there could be a case for having several shell tasks that were specialised in a single dbt thing (run, test, snapshot, etc) but I don’t really see the point. We rename the tasks responsible for run or tests to give more clarity. Therefore I don’t have much thoughts regarding new/improvements for the task library (hence the previous question). My unicorn wish would be in the lines of Jared, being able to inspect the dbt graph in the Prefect UI schematic with runtimes and potential failures would be more than fantastic. I also see myself going to the dbt docs page to start understanding the impact of a failed model. I could also see benefits to using the Artifacts to give better overview of the run report than you get from the logs. In the logs you lose coloured text as well as some formatting that’s off. Having an artifact page that resembles a clearer run report to what’s inside dbt cloud would be nice.
👍 1
1
🙌 1
m

Matthias

02/21/2022, 11:03 AM
I tend to agree with @Noah Holm! The shell task is good as-is and if you want more flexibility in changing e.g. model selectors, you can create a wrapper task that does just that based on an optional input (string or dict). The biggest gain would be to focus on functionality to enhance observability (viz of dbt DAG and using the generated Artifacts to make it easier to inspect/troubleshoot flows)
1
a

Andrew Black

02/21/2022, 7:55 PM
This is wonderful feedback thank you!
m

Matthias

02/23/2022, 7:56 PM
Someone on this channel asked if
dbt-ol
was supported by the dbt shell task. After further exploration of open lineage (I never heard of it), I figured the command “just” optionally parses the manifest to generate the necessary events. Perhaps worth exploring if we can create an additional task to do this? Anyway, I thought this could give some inspiration…
a

Andrew Black

02/25/2022, 7:59 PM
Thank you @Matthias. Are you thinking a Prefect task to do this, or a way for Prefect and dbt to work together?
@Noah Holm I’m sorry for the slow reply. To us, a task is basically a technical integration while a partnership entails working together to make our products better, as well as usually some marketing activities around that. dbt is a great example, where we are coordinating to make our products as powerful and easy as possible for our joint end users
🙌 1
@Matthias @Jared Noynaert - Such great feedback. Thank you for the extensive outlining, making sure our teams see all of it.
It sounds like the summary is around sub-run observability inside a dbt run, as well as being able to potentially isolate different parts of a dbt run that can be interrupted by a different Prefect task outside of dbt?
👍 2
m

Matthias

02/25/2022, 8:06 PM
@Andrew Black as mentioned before, I never heard of open lineage before, so I have no idea about its adoption… I mainly pointed to the project for inspiration.
a

Andrew Black

02/25/2022, 8:06 PM
got it excellent!
We’ve definitely explored it and are considering it. Thanks for the comparison, though.
m

Matthias

02/28/2022, 2:18 PM
@Andrew Black been doing some digging this weekend on how Dagster is approaching this. It is nicely explained in this blog post. I was thinking, would it be possible to integrate dbt info as a Prefect artifact? It would be nice to have e.g. the lineage graph available there.
4 Views