Ask Your Question
1

How to access system's environment variables in Query consumer.

asked 2020-01-29 23:38:54 -0600

Shashank Shukla gravatar image

How can I access system's environment variables in Streamsets pipeline. I want to read database connection URL which is in a system variable in a JDBC executor.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-02-03 12:48:34 -0600

metadaddy gravatar image

You cannot access an environment variable directly from Expression Language, but you can do it indirectly via a Runtime Property. Use ${env("ENV_VAR_NAME")} in the Runtime Property, then you can reference that property in configuration with ${runtime:conf(<property name>)}.

For example, I set an environment variable:

export PG_URL=jdbc:postgresql://laptop.superpat.com/pat

I then added this setting to my runtime properties file (I'm using a separate runtime properties file as outlined in the docs):

pg_url=${env("PG_URL")}

Finally, I was able to reference the property in my JDBC Query Consumer:

image description

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2020-01-29 23:38:54 -0600

Seen: 23 times

Last updated: Feb 03