Also, was working through this demo of dagster/dbt...
# ask-community
j
Also, was working through this demo of dagster/dbt: https://docs.dagster.io/integrations/dbt/using-dbt-with-dagster/part-one Everything works except trying to materialize the last asset
order_count_chart
. I was launching this from the
tutorial_finished/
directory so I wouldn't have missed any steps (and can reproduce in my own version in
tutorial_template/
).
e
Hey there! Could you share a bit more detail about what's happening when you try to materialize this asset?
j
The error I get is
Copy code
dagster._core.errors.DagsterExecutionHandleOutputError: Error ocurred while handling output "result" of step "order_count_chart":

dagster._check.CheckError: Invariant failed. Description: Unexpected 'None' output value. If a 'None' value is intentional, set the output type to None
It seems like this is breaking at the end of the definition of asset
order_count_chart
. Maybe something changed in the newest version? I am using version
1.1.17
. Does the default behavior expect something returned? In other places I've seen metadata being handled with
return Output(some_val, metadata={some dict})
I am able to get it to work by returning any DataFrame object but was wondering if something funky is going on given that I was using the finished demo code.
A follow up question that I have is what is the recommended way to debug this? Is there any way I can just materialize the last asset by using a previously materialized upstream asset? My fix worked but it's easier to debug when you are trying this out interactively
e
I'm taking a look before a gauntlet of meetings kicks off - I'll try to get back to you soon(ish) about what I find. It's possible something was changed at some point and the example wasn't updated.
j
ok thank you!
j
hey! I think this is a bug. I’ll open a PR to fix it
❤️ 1
a quick fix on your side will be to add the
-> None:
return type annotation to
order_count_chart
like this
Copy code
def order_count_chart(context, customers: pd.DataFrame) -> None:
fyi the fix is in and if you re-pull the project using
dagster project from-example --name tutorial_dbt_dagster --example tutorial_dbt_dagster
you’ll get the updated project
j
ok thanks @jamie -- I also had another question relating to how to debug this. What is the recommended way to debug a specific asset?
to be more explicit -- say an asset depends on input from another asset so what is a good way for me to interactively materialize the downstream asset?
j
so for testing/debugging assets, you can invoke them like normal python functions! so you could make a new file and import your assets in question and then pass them fake values so that you can test. We go over that here in the docs So for a super simple example, if you have an asset like this
Copy code
@asset 
def my_downstream_asset(upstream_asset):
   return upstream_asset * 2
you could test it like this
Copy code
my_downstream_asset(3)
and then ensure it returns the value you expect For more complicated assets, sometimes it can be harder to debug like this since creating the upstream inputs can be really difficult. Depending on how you materialize your assets you can use pdb to do interactive debugging and i can give a quick example of that if you’d like. it’s also pretty basic, but putting a bunch of print or logging statements in the body of your assets can also be effective, and is generally what i reach to first when debugging.
thank you box 1