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

Kate Ross

05/04/2023, 10:09 AM
Hello everyone, could someone give me a pointer on how Dagster finds the content of a SourceAsset? For example, if I have a pre-computed .csv file I want to make available as a SourceAsset, how do I tell Dagster where that file is located?
🤖 1
dagster bot responded by community 1
v

Vinnie

05/04/2023, 10:33 AM
k

Kate Ross

05/04/2023, 10:40 AM
Thanks @Vinnie! This makes sense - is there an example that you know of anywhere? The io managers that I’ve been using for software-defined assets don’t specify a file name or location, since that is determined by the asset, it’s partitions, and DAGSTER_HOME. So I am a little unclear on how to do this for SourceAssets.
v

Vinnie

05/04/2023, 10:48 AM
Warning: I’m just spitballing since I never worked with this, but I’m imagining it would look something like this:
Copy code
class MySourceAssetIOManager(ConfigurableIOManager):
    def load_input(self, context):
        with open("my/asset/path") as f:
            return f.read()

SourceAsset("my_source_asset", io_manager_def=MySourceAssetIOManager)
Basically I assume you’d have to find a way to tell your IO Manager where to find the source asset, this could be done with the asset keys or other information you can find within the `InputContext`(https://github.com/dagster-io/dagster/blob/master/python_modules/dagster/dagster/_core/execution/context/input.py#L39)
k

Kate Ross

05/04/2023, 10:49 AM
ok, thanks! I’ll look into it and mess around
3 Views