Hi all, after reading docs and FAQ :wink: i still ...
# ask-community
a
Hi all, after reading docs and FAQ šŸ˜‰ i still have questions. I canā€™t find any ā€œrecommendedā€ way to do this: ā€¢ find ZIP file on folder (for now, later S3) ā€¢ unpack ZIP file (contains several CSV files which each represent one or more ā€œinvoicesā€) ā€¢ pre-process the CSV files (e.g. split further into sub-CSVs if necessary) ā€¢ create an invoice for each ā€œfinalā€ CSV from what iā€™ve read, each ā€œfinal CSVā€ file should be an asset, which is then processed. so my main trouble lies in the ā€œtransformationā€ from an ā€œincomplete assetā€ (e.g. a ZIP file) to several ā€œmore fine-grained assetsā€ (e.g. several CSV files) which are then, again, processed further. my initial thought was to have sensors, which react on asset creations, but i was unable to connect the components ā€¦ :
Copy code
@op
def unpack_zip():
    # ... which zip?
    ...

@job
def handle_zip():
    # no idea where zip_file should come from
    dir = unpack_zip(zip_file)

    for f in os.listdir(dir):
        # now how do i create "smaller" assets (1 per CSV file)?
        # is that the right approach?        
        ...


@sensor(job=handle_zip)
def zip_file():
    # should each found ZIP file not be an asset itself?
    # also, what _is_ actually _run_ here?
    yield RunRequest(run_key="1", run_config={"file": "./testdata/1.zip"})
so frankly iā€™m kinda stuck and would appreciate any help here. please donā€™t just link to the docs without further explanation, i have read a lot of them and i really donā€™t see it ā€¦ šŸ˜ž (btw, i would be happy to help out with them, once i understand it)
s
hi Axel - there are two ways to accomplish this: ā€¢ with dynamic graphs: https://docs.dagster.io/concepts/ops-jobs-graphs/dynamic-graphs#dynamic-graphs ā€¢ with software-defined assets, the newly-introduced dynamic asset partitions: https://docs.dagster.io/concepts/partitions-schedules-sensors/partitions#dynamically-partitioned-assets eventually, we'd like to essentially merge these two so you can use them together, but we're not there yet. here's where we're tracking this: https://github.com/dagster-io/dagster/issues/9559