David Weber
04/19/2023, 9:27 AMadls2_resource
) with the example in the documentation: https://docs.dagster.io/_apidocs/libraries/dagster-azure
from dagster import job, op
from dagster_azure.adls2 import adls2_resource
@op(required_resource_keys={'adls2'})
def example_adls2_op(context):
return list(context.resources.adls2.adls2_client.list_file_systems())
@job(resource_defs={"adls2": adls2_resource})
def my_job():
example_adls2_op()
We want to pass the config as YAML, as it is described in the docu:
resources:
adls2:
config:
storage_account: my_storage_account
# str: The storage account name.
credential:
sas: my_sas_token
# str: the SAS token for the account.
key:
env: AZURE_DATA_LAKE_STORAGE_KEY
# str: The shared access key for the account.
DefaultAzureCredential: {}
# dict: The keyword arguments used for DefaultAzureCredential
# or leave the object empty for no arguments
DefaultAzureCredential:
exclude_environment_credential: true
But how do we pass this YAML to dagster?
Because in dagit, we always get this error: KeyError: 'adls2'
When we pass the config directly in the OP decorator, it works. But it doesn't solve our problem because ultimately we want to use the ADLS2 Resource in a Sensor - which doesn't take the the config via the decorator...owen
04/19/2023, 5:50 PM{"adls2": adls2_resource.configured(<config>)}
into build_resources, where <config>
is the python dictionary representation of everything under
resources:
adls2:
config:
i.e.:
{
"storage_account": "my_storage_account",
"credential": {
"sas": "my_sas_token",
"key": {
"env": "AZURE_DATA_LAKE_STORAGE_KEY"
},
"DefaultAzureCredential": {
"exclude_environment_credential": True
}
}
}
David Weber
04/20/2023, 2:53 PM