depot.properties
A depot.properties file is used to setup Snowflake connection and credentials. It is picked up by various Depot tests (e.g. Snowflake tests or Depot-local).
The file should be placed in the working directory (or some parent directory to make it easier in monorepos).
At a glance, the properties file looks like this:
environmentName=xyztest
sql.dialect=snowflake
sql.connection=jdbc:snowflake://aa12345.eu-west-1.snowflakecomputing.com
sql.database=EXAMPLE_DB
sql.warehouse=EXAMPLE_WAREHOUSE
sql.username=EXAMPLE_USER
sql.privateKey=MIIEvgIBA[EXAMPLE]wEcK
aws.profile=my-profile
aws.region=eu-west-1
The sql.connection entry can contain a Snowflake URL with account identifier,
e.g. sql.connection=jdbc:snowflake://org-acc.snowflakecomputing.com.
The Snowflake account + region could be specified explicitly instead of sql.connection,
via sql.accountId and sql.region:
...
sql.accountId=aa12345
sql.region=eu-west-1
An alternative configuration for credentials is to specify an AWS Secrets Manager credential ARN
via sql.credentialsSecretArn. The secret must contain username, password and privateKey entries.
Configuration via sql.credentialsSecretArn might not be supported everywhere and would require AWS access.
environmentName=xyztest
sql.dialect=snowflake
sql.connection=jdbc:snowflake://aa12345.eu-west-1.snowflakecomputing.com
sql.database=EXAMPLE_DB
sql.warehouse=EXAMPLE_WAREHOUSE
sql.credentialsSecretArn=arn:aws:secretsmanager:eu-west-1:123456789012:secret:ws-example-snowflake-credentials-O72rNM
aws.profile=my-profile
aws.region=eu-west-1
You can read more about the test configuration and options in the stage-depot/packages/depot-test repository README.md.
Generate in CI
In CI/build settings, the depot.properties file can be generated
by using depot-generate-properties binary in @stage-tech/depot-test package:
npx depot-generate-properties \
--sql-database ${{ secrets.SFK_DATABASE }} \
--sql-username ${{ secrets.SFK_USERNAME }} \
--sql-private-key ${{ secrets.SFK_PRIVATE_KEY }}
Workstation: profiles
Sometimes you need to rapidly switch between different sets of parameters and setting up (and flipping between) multiple sets of environment variables is not convenient as it requires you to update the environment variables section in your IDE or terminal.
You can set up profiles using the profiles.# section in the depot.properties file:
profiles.0.id=keep
profiles.0.title="Keep Schema" profile
profiles.0.keepSchema=true
profiles.1.id=red
profiles.1.title="Red" profile
profiles.1.schemaPrefix=BLUE_
profiles.2.id=green
profiles.2.title="Green" profile
profiles.2.schemaPrefix=GREEN_
profiles.3.id=blank
profiles.3.title="Blank prefix" profile
profiles.3.schemaPrefix=
The # part in profiles.# should be a sequentially increasing number starting from 0. Each profile
is defined by an id field and one or more other fields according to the table in parameters.