This sample dbt repo is setup to house examples of snowflake object management with _dbt. It contains the following macros, with example data in the ./snowflake folder.
This macro helps with the creation and management of snowflake users. Any new users that are in the users file will be created and existing will be updated. It is non-destructive and will only disable users with the disabled
flag.
The variable DRY_RUN
will default to True, which will log statements without sending to snowflake for execution.
In order to not version control / store passwords in plain text, you will also need to pass in the variable PASSWORD
which can be passed to your end users, and changed upon their first login.
First timers can use the script download_snowflake_users.py to download any existing users and setup ./snowflake/users/users.yml
which you may add any new users and their attributes to. Once set up you can run:
dbt run-operation manage_snowflake_users \
--args "$(cat ./snowflake/users/users.yml)" \
--vars '{PASSWORD: $3cr3t}' # add {DRY_RUN: False} to execute
This macro helps with management of whitelists and takes a multiple file approach - it will overwrite exising with the ip addresses included in the .yml files. If adding new IPs, it is also best practivce to document the associated services/ users.
dbt run-operation create_whitelist \
--args "$(cat ./snowflake/whitelist/{file_name}.yml)" \
# add --vars {DRY_RUN: False} to execute
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices