Hi everyone,
So I figured out how I can pass metadata to the io-manager, but I wonder if it's really the best way to achieve what I want: re-use a DB connection (only defined once) with asset-level configuration (e.g. database and collection for a mongoDB)
What do you think?
c
chris
07/10/2023, 6:12 PM
Hey! For future reference - we tend to monitor github discussion more, recommend posting there instead of stack overflow
chris
07/10/2023, 6:15 PM
As for your question, I don’t necessarily think metadata is the best way to do this, what about making the db connection not instantiate until you’re actually within the asset itself, and then pass the relevant parameters? Something like this;
Copy code
@asset
def the_asset(my_db_resource: MyDBResource):
with my_db_resource.connect(db="current", collection=...)
...