Harrison Conlin
03/16/2023, 11:24 AMreports
which gets all the reports + basic metadata and updates the dynamic partitions for the individual asset report
.
report
depends on reports
and I then materialise all the report
partitions which gets its metadata entry. It's a bit slow and painful.
Ideally I'd get of the reports
asset but I want to keep IO managers, so my plan was to move the API call into a job, loop through the results, create a OutputContext
via dagster.build_output_context()
for each report, pass that to the IO managers handle_output
function and fire off `AssetMaterialization`s. Happy times I was hoping but as build_output_context() doesn't create a step context, OutputContext.has_asset_partitions
fails.
Admittedly I am going down an ugly route but can you see any alternatives?claire
03/16/2023, 11:59 PMHarrison Conlin
03/18/2023, 1:40 AMclaire
03/20/2023, 9:30 PMreports
asset that queries for the initial API call, yielding all the data you need as output and creating all the dynamic partitions you need via context.instance.add_dynamic_partitions(...)
• have each report
asset with its own dynamic partitions def depend on the reports
asset
• in a schedule, update the reports
asset as frequently as desired based on the rate limiting
• in a sensor, check whenever the reports
asset is materialized, and then kick off a run request for each different report
asset
This approach I think is cleaner and will allow you to update all of the downstream report
assets after you update reports
automatically. And you'll be able to load the result of the latest API call in each report
asset.Harrison Conlin
03/22/2023, 5:35 AM