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

Rasmus Hallén

08/24/2023, 1:08 PM
Is there a good way to test materialization of assets with a configurable resource intialized with variables from a .env-file? I.e within my test-folder i can write an "asset materialization test" like so:
Copy code
def test_materialization():
    assets = [some_asset]
    result = materialize(some_asset, resources=some_resource_depending_on_environment)
    assert result.success
🤖 1
j

jamie

08/24/2023, 2:38 PM
you could initialize all of your resource config using EnvVar and then those config values will be read from environment variables
Copy code
from dagster import EnvVar

materialize([some_asset], resources={"my_resource": MyResource(param1=EnvVar("FOO"), param2=EnvVar("BAR")})
r

Rasmus Hallén

08/25/2023, 2:16 PM
thanks!!
2 Views