is it possible to get the config of an asset in th...
# ask-ai
l
is it possible to get the config of an asset in the dependency?
s
Yes, it is possible to access the configuration of an asset within its dependencies. According to the documentation, when you define an asset with a
config_schema
, you can access the runtime configuration provided for the asset in its compute function under
context.op_config
. Here's an example from the documentation that illustrates how to define an asset with a configuration schema and access the configuration within the asset's compute function:
Copy code
python from dagster import asset, materialize  @asset(config_schema={"interest_rate": float}) def asset_with_config(context):     return some_financial_calculation(rate=context.op_config["interest_rate"])  materialize(     [asset_with_config],     run_config={"ops": {"asset_with_config": {"config": {"interest_rate": 0.05}}}} )
In this example, the
asset_with_config
asset is defined with a configuration schema that expects an
interest_rate
of type
float
. When the asset is materialized, the
run_config
is provided, specifying the
interest_rate
value. Within the asset's compute function, the configuration is accessed via
context.op_config
. This mechanism allows you to pass configuration values to assets at runtime, which can then be used by the assets or their dependencies during execution.