https://dagster.io/ logo
#ask-community
Title
# ask-community
g

geoHeil

02/24/2023, 11:56 AM
How can I include custom asset observations i.e. row count into DBT-backed assets? Are there any configuration options I am overlooking?
v

Vinnie

02/24/2023, 12:28 PM
You should be able to use the
runtime_metadata_fn
parameter in
load_assets_from_dbt_*
. I’m not sure if that generates an AssetObservation, but it would add to the metadata returned.
1
a

Andrea

02/24/2023, 4:08 PM
Some documentation example on how to use
runtime_metadata_fn
for dbt projects would go a long way.
v

Vinnie

02/24/2023, 4:10 PM
c

claire

02/24/2023, 5:51 PM
One option is in your IO manager's
handle_output
method, you could do
context.log_event(AssetObservation(...))
g

geoHeil

02/28/2023, 7:58 AM
Is there any exaple out there? It would be cool of the default docs of dagster could showcase such an example.
c

claire

02/28/2023, 11:50 PM
hmm... our api docs do have a simple example, but it currently isn't displaying correctly: https://docs.dagster.io/_apidocs/io-managers#dagster.OutputContext.log_event Here it is copy pasted:
Copy code
from dagster import IOManager, AssetMaterialization

            class MyIOManager(IOManager):
                def handle_output(self, context, obj):
                    context.log_event(AssetMaterialization("foo"))
I agree that this pattern would be helpful to document in the docs though. We also have a similar utility that attaches observations via the
load_input
method of an IO manager. I'd recommend filing an issue so that we can track adding this to our documentation
g

geoHeil

03/01/2023, 8:28 AM
17 Views