BK
05/23/2022, 5:05 PMfrom dagster import build_op_context, op, Field, String, job, resource
from dagster_aws.redshift import redshift_resource
@op(required_resource_keys={'redshift'})
def example_redshift_op(context):
return context.resources.redshift.execute_query('SELECT 1',
fetch_results=True)
redshift_configured = redshift_resource.configured({"conn_str": Field(String)})
context = build_op_context(resources={'redshift': redshift_configured})
assert example_redshift_op(context) == [(1,)]
sean
05/23/2022, 9:43 PMBK
05/24/2022, 5:09 AMsean
05/24/2022, 5:55 PMpassword
is of type StringSource
. Here are the StringSource
docs: https://docs.dagster.io/_apidocs/config#dagster.StringSource
StringSource
takes either a literal string value or a selector indicating how to load the value. So instead of passing a literal string for password
(e.g. "password": "somepassword"
, you can instead pass "password: {"env": "ENV_VAR_HOLDING_MY_PASSWORD"}
BK
05/25/2022, 3:08 PM