Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSO Creds to snowflake-dagster Profile #686

Merged
merged 7 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.local.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file should be copied to .env.local and manually filled out by devs after cloning.
export SYSTEM_SNOWFLAKE_USER='[email protected]'
export SYSTEM_SNOWFLAKE_PASSWORD='' # intentionally left blank for externalbrowser auth
export SYSTEM_SNOWFLAKE_AUTHENTICATOR='externalbrowser'
export SYSTEM_SNOWFLAKE_ROLE='ROLE_NAME'
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ dbt-test:
dbt test

dbt-perms:
python dbt_scripts/grant_permissions.py
python dbt_scripts/grant_permissions.py

pipcompile:
uv pip compile --annotation-style=line requirements.in -o requirements.txt --no-strip-extras
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,9 @@ There are two ways to get help:
3. Write SQL model changes
4. Open a PR and view results of your changes directly in the Github Actions - more on this in [adding a new metric](#adding-a-new-metric).

For running on snowflake, create a `.env.local` file in the root of this repo with the following structure:
For running on snowflake, create a `.env.local` file in the root of this repo by running `cp .env.local.template .env.local` and filling out the necessary values.

```
export SYSTEM_SNOWFLAKE_USER=''
export SYSTEM_SNOWFLAKE_PASSWORD=''
export SYSTEM_SNOWFLAKE_ROLE=''
```

Run `source .env.local` to load these environment variables into your shell.
Run `source syncenv` to load these environment variables into your shell and install the necessary Python dependencies.

## System Design

Expand Down
4 changes: 3 additions & 1 deletion profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ snowflake-dagster:
account: IYTNLTJ-MWB17343

user: "{{ env_var('SYSTEM_SNOWFLAKE_USER') }}"
password: "{{ env_var('SYSTEM_SNOWFLAKE_PASSWORD') }}"
password: "{{ env_var('SYSTEM_SNOWFLAKE_PASSWORD', '') }}"
# snowflake client_store_temporary_credential is automatically set by dbt-snowflake
authenticator: "{{ env_var('SYSTEM_SNOWFLAKE_AUTHENTICATOR', 'snowflake') }}"

role: "{{ env_var('SYSTEM_SNOWFLAKE_ROLE') }}"
database: PC_DBT_DB
Expand Down
8 changes: 8 additions & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# run `make pipcompile` to update requirements.txt
dbt-core==1.7.17
dbt-extractor==0.5.1
dbt-semantic-interfaces==0.4.3
dbt-snowflake==1.7.1
pandas==2.0.2
numpy==1.26.4
sqlfluff==3.1.0
87 changes: 78 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,78 @@
dbt-bigquery==1.7.4
dbt-core==1.7.17
dbt-extractor==0.5.1
dbt-semantic-interfaces==0.4.3
dbt-snowflake==1.7.1
pandas==2.0.2
numpy==1.26.4
sqlfluff==3.1.0
pre-commit
# This file was autogenerated by uv via the following command:
# uv pip compile --annotation-style=line requirements.in -o requirements.txt --no-strip-extras
agate==1.7.1 # via dbt-core, dbt-snowflake
annotated-types==0.7.0 # via pydantic
appdirs==1.4.4 # via sqlfluff
asn1crypto==1.5.1 # via snowflake-connector-python
attrs==24.3.0 # via jsonschema, referencing
babel==2.16.0 # via agate
backports-tarfile==1.2.0 # via jaraco-context
certifi==2024.12.14 # via requests, snowflake-connector-python
cffi==1.17.1 # via cryptography, dbt-core, snowflake-connector-python
chardet==5.2.0 # via diff-cover, sqlfluff
charset-normalizer==3.4.0 # via requests, snowflake-connector-python
click==8.1.7 # via dbt-core, dbt-semantic-interfaces, sqlfluff
colorama==0.4.6 # via dbt-core, sqlfluff
cryptography==44.0.0 # via pyopenssl, snowflake-connector-python
dbt-core==1.7.17 # via dbt-snowflake, -r requirements.in
dbt-extractor==0.5.1 # via dbt-core, -r requirements.in
dbt-semantic-interfaces==0.4.3 # via dbt-core, -r requirements.in
dbt-snowflake==1.7.1 # via -r requirements.in
diff-cover==9.2.1 # via sqlfluff
filelock==3.16.1 # via snowflake-connector-python
idna==3.10 # via dbt-core, requests, snowflake-connector-python
importlib-metadata==6.11.0 # via dbt-semantic-interfaces, keyring
iniconfig==2.0.0 # via pytest
isodate==0.6.1 # via agate, dbt-core
jaraco-classes==3.4.0 # via keyring
jaraco-context==6.0.1 # via keyring
jaraco-functools==4.1.0 # via keyring
jinja2==3.1.4 # via dbt-core, dbt-semantic-interfaces, diff-cover, sqlfluff
jsonschema==4.23.0 # via dbt-core, dbt-semantic-interfaces
jsonschema-specifications==2024.10.1 # via jsonschema
keyring==25.5.0 # via snowflake-connector-python
leather==0.4.0 # via agate
logbook==1.5.3 # via dbt-core
markupsafe==3.0.2 # via jinja2
mashumaro[msgpack]==3.15 # via dbt-core
minimal-snowplow-tracker==0.0.2 # via dbt-core
more-itertools==10.5.0 # via dbt-semantic-interfaces, jaraco-classes, jaraco-functools
msgpack==1.1.0 # via mashumaro
networkx==3.4.2 # via dbt-core
numpy==1.26.4 # via pandas, -r requirements.in
packaging==24.2 # via dbt-core, pytest, snowflake-connector-python
pandas==2.0.2 # via -r requirements.in
parsedatetime==2.6 # via agate
pathspec==0.11.2 # via dbt-core, sqlfluff
platformdirs==4.3.6 # via snowflake-connector-python
pluggy==1.5.0 # via diff-cover, pytest
protobuf==4.25.5 # via dbt-core
pycparser==2.22 # via cffi
pydantic==2.10.4 # via dbt-semantic-interfaces
pydantic-core==2.27.2 # via pydantic
pygments==2.18.0 # via diff-cover
pyjwt==2.10.1 # via snowflake-connector-python
pyopenssl==24.3.0 # via snowflake-connector-python
pytest==8.3.4 # via sqlfluff
python-dateutil==2.9.0.post0 # via dbt-semantic-interfaces, pandas
python-slugify==8.0.4 # via agate
pytimeparse==1.1.8 # via agate
pytz==2024.2 # via dbt-core, pandas, snowflake-connector-python
pyyaml==6.0.2 # via dbt-core, dbt-semantic-interfaces, sqlfluff
referencing==0.35.1 # via jsonschema, jsonschema-specifications
regex==2024.11.6 # via sqlfluff
requests==2.32.3 # via dbt-core, minimal-snowplow-tracker, snowflake-connector-python
rpds-py==0.22.3 # via jsonschema, referencing
six==1.17.0 # via isodate, minimal-snowplow-tracker, python-dateutil
snowflake-connector-python[secure-local-storage]==3.12.4 # via dbt-snowflake
sortedcontainers==2.4.0 # via snowflake-connector-python
sqlfluff==3.1.0 # via -r requirements.in
sqlparse==0.5.3 # via dbt-core
tblib==3.0.0 # via sqlfluff
text-unidecode==1.3 # via python-slugify
tomlkit==0.13.2 # via snowflake-connector-python
tqdm==4.67.1 # via sqlfluff
typing-extensions==4.12.2 # via dbt-core, dbt-semantic-interfaces, mashumaro, pydantic, pydantic-core, snowflake-connector-python
tzdata==2024.2 # via pandas
urllib3==1.26.20 # via dbt-core, requests
zipp==3.21.0 # via importlib-metadata
2 changes: 0 additions & 2 deletions syncenv
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ uv pip sync requirements.txt
chmod +x dbt_scripts/run_sqlfluff_on_changed_files.sh

source .env.local


Loading