Hello Everyone. I am currently new to dagster and ...
# ask-community
b
Hello Everyone. I am currently new to dagster and i am looking to connect to an AWS Redshift cluster without displaying the password as it in the tutorial. This the route i am currently taking just like the sqlite tutorial
Copy code
from 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,)]
🤖 1
s
Hi, would you mind clarifying the issue a bit for me? In the posted code snippet I don’t see a password.
b
Hello @sean i don't want to share the password, just looking for a way to use my Redshift credentials without posting on code snippet.
s
I had a look at the example, you’ll notice that
password
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 does this resolve your issue?
b
Thanks Sean for the help. It does.