Hi, are there any examples on how to get custom ru...
# integration-dbt
Hi, are there any examples on how to get custom run metadata from dbt runs? I want to get the row count of the model after its materialization (and plot it in the UI)
hi @Peter Lim!
(https://docs.dagster.io/_apidocs/libraries/dagster-dbt#assets-dbt-core) sounds like what you're looking for here
thank you for the reply, Owen! Do you have an example function for this?
I was actually looking at this earlier but don’t know how to use it
yeah it's got a pretty nasty type signature for something with no examples 😬 . Easiest way to think about it is that it's a function with two arguments. The first is a
argument (that's the same thing that's passed into the
argument of an asset), and the second is a dictionary of metadata parsed out of the
file. So one example would be
Copy code
def custom_metadata_fn(context, node_info):
    table_name = node_info["name"]
    table_schema = node_info["schema"]
    n_rows = ... # query database
    return {"n_rows": n_rows}
then you can just have
load_assets_from_dbt_manifest(..., runtime_metadata_fn=custom_metadata_fn)
thank you! I will try this out tomorrow 🙂