https://linen.dev logo
#singer-tap-development
Title
# singer-tap-development
s

silverbullet1

07/06/2023, 2:01 PM
Hi all, When trying to read my username and password from env vars instead of
meltano.yml
, my code is not able to read them. Do I need to explicitly read from
os.environ
or is it handled by default in the SDK ? My code is breaking at the point where I am forming the sql_alchemy connection string / validating input parameters.
Copy code
url = URL.create(
            drivername='redshift+redshift_connector',  # indicate redshift_connector driver and dialect will be used
            host=self.config['host'],  # Amazon Redshift host
            port=self.config['port'],  # Amazon Redshift port
            database=self.config['database'],  # Amazon Redshift database
            username=self.config['user'],  # Amazon Redshift username
            password=self.config['password']  # Amazon Redshift password
        )
It tries to find user and pass in
self.config
and gives
KeyError
. My env vars are
TAP_REDSHIFT_USER
and `TAP_REDSHIFT_PASSWORD`and they have been specified in my
meltano.yml
like this:
Copy code
default_environment: test
environments:
- name: test
  env:
    TAP_REDSHIFT_USER: foo
    TAP_REDSHIFT_PASSWORD: bar
Do I have to map these keys with env vars somewhere? I tried to find it in existing implementations but couldn’t find.