I’d like to define an `AutoMaterializePolicy.eager...
# ask-community
h
I’d like to define an
AutoMaterializePolicy.eager()
policy to most of my assets via
load_assets_from_modules
but
lazy()
for one of them. I expected to be able to override it for this single asset by adding
auto_materialize_policy
to it, but get a
DagsterInvalidDefinitionError
“AutoMaterializePolicy already exists on assets”. Is there another option than defining this asset in a different module or defining an explicit asset/policy-mapping for each asset?
r
Hey Holger, you could set this in your dbt model config. If the model has the config:
Copy code
dagster_auto_materialize_policy:
  type: lazy
It will get your desired AMP.
Please ask in #dagster-dbt if you have further questions!
h
Thanks Rex. I‘m not yet using dbt here, just plain dagster. Is there an option to avoid the policy conflict and nervertheless having ab overridable default policy?
r
Ah sorry, I misread the API that you were using (
load_assets_from_modules
). @claire mind taking a look at this?
c
Hi Holger. Unfortunately, there is no way to override this behavior at the moment. The rationale here is that it may cause confusion if auto materialize policies can be silently overwritten. I think your best options are the ones you mentioned--defining the asset in a separate module, or explicitly applying the policy on each asset.
h
Thank you for confirming, @claire! Renaming to or introducing a new
default_auto_materialize_policy
would be perhaps an option, in case more people struggle with that. For now I’ll split my modules.
🌈 1