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

Guy McCombe

01/30/2023, 3:45 PM
Hey! Is there a way to pass a path (or similar) from an asset materialization config to the
ins
parameter? My specific case is passing a google sheet URL to an asset and having an io manager read it in as a pandas DataFrame. This was how I imagined it might look but, it raises a code location error that
AttributeError: 'In' object has no attribute 'key'
.
Copy code
@asset(
    io_manager_key="gsheets_io",
    config_schema={
        "input_url": str,
    },
    ins={
        "df": In(
            input_manager_key="gsheets_io",
            asset_key=lambda context: AssetKey([context.config["input_url"]]),
        )
    },
)
def asset_fn(context, df):
    ...
j

jamie

01/30/2023, 4:28 PM
Hi @Guy McCombe does the
input_url
need to change between materializations of the asset?
g

Guy McCombe

01/30/2023, 4:31 PM
That was the plan, yep
I wanted to set it up so that any user could bring any of their google sheets to be processed by this asset. I figured that the easiest way for this to happen would be to link the sheet in the materialization config
j

jamie

01/30/2023, 4:37 PM
ok. You may want to use an op for this instead. Basically an asset is supposed to represent like a single dataset stored in the same location. You might add to that dataset over time, but the location where the data is stored doesnt change. If you use an op you can provide configuration values via op config You could also look into generating assets in a factory function based on the user input. if that sounds more like what you need i can write up some pseudocode
ty spinny 1
g

Guy McCombe

01/30/2023, 4:38 PM
OK I’ll give these a look, thanks jamie 😃
Can ops still be partitioned like assets?
j

jamie

01/30/2023, 4:41 PM
yep!
🎉 1
2 Views