In my understanding each `materialize` operation r...
# ask-community
w
In my understanding each
materialize
operation refreshes and overwrites an existing
asset
. Is it possible to materialize to a different asset each time I provide a different materialize run config?
c
hmm.. this is not possible because each asset provided to the
assets
argument of
materialize
must be run in this call. You could make this call dynamic and pass in a variable list of assets, or you could with an existing job call
execute_in_process(asset_selection=[...])
w
Could you plz articulate a bit? we could also setup a short huddle/zoom if it works for u
c
In order to materialize a certain set of assets, you would need to explicitly select those assets. You could either call
materialize
with a certain selection of assets:
Copy code
config_by_asset = {"asset_1": {"config": 3}, "asset_2": {"config": 2}}

all_assets = load_assets_from_current_module()


def materialize_selected_assets(asset_names):
    materialize(
        [asset for asset in all_assets if asset.op.name in asset_names],
        run_config={"ops": {asset_name: config_by_asset[asset_name] for asset_name in asset_names}},
    )
or you can define an asset job and pass in an asset selection with config:
Copy code
assets_job = define_asset_job("all_assets_job").resolve(all_assets, [])
assets_job.execute_in_process(
    asset_selection=[AssetKey("asset_1")], run_config={"ops": config_by_asset}
)
Happy to jump on a call if it would help