Skip to content

Commit

Permalink
Merge pull request #1 from dbt-labs/add_codespace
Browse files Browse the repository at this point in the history
enable codespace
  • Loading branch information
dataders authored Sep 16, 2022
2 parents 443ef59 + 9efe6ee commit 8b98da4
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 0 deletions.
94 changes: 94 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Update the VARIANT arg in docker-compose.yml to pick a Python version: 3, 3.8, 3.7, 3.6
{
"name": "dbt",
"dockerFile" : "Dockerfile",
"settings": {
"terminal.integrated.defaultProfile.linux#": "/bin/sh",
"files.associations": {
"*.sql": "jinja-sql",
"*.sqlfluff": "ini",
"*.yml": "yaml",
"**/target/**": ""
},
"sql.linter.executablePath": "/usr/local/bin/sqlfluff",
"sql.format.enable": true,
"sql.linter.run": "onType",
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/__pycache__": true
},
"findrelated.workspaceRulesets": [
{
"name": "sql",
"rules": [
{
"pattern": "^(.*/)?models/(.*/)?(.+\\.sql)$",
"locators": [
"**/compiled/**/$3"
]
},
{
"pattern": "^(.*/)?compiled/(.*/)?(.+\\.sql)$",
"locators": [
"**/run/**/$3"
]
},
{
"pattern": "^(.*/)?run/(.*/)?(.+\\.sql)$",
"locators": [
"**/models/**/$3"
]
}
]
}
],
"findrelated.applyRulesets": [
"sql"
],
"findrelated.applyWorkspaceRulesets": [
"sql"
],
"workbench.editor.highlightModifiedTabs": true,
"workbench.editor.labelFormat": "medium",
"workbench.editor.revealIfOpen": true,
"editor.rulers": [
99
],
"yaml.schemas": {
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_yml_files.json": [
"/*.yml",
"!profiles.yml",
"!dbt_project.yml",
"!packages.yml",
"!selectors.yml",
"!profile_template.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/dbt_project.json": [
"dbt_project.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/selectors.json": [
"selectors.yml"
],
"https://raw.githubusercontent.com/dbt-labs/dbt-jsonschema/main/schemas/packages.json": [
"packages.yml"
]
}
},
"extensions": [
"bastienboutonnet.vscode-dbt",
"dorzey.vscode-sqlfluff",
"editorconfig.editorconfig",
"amodio.find-related",
"ms-azuretools.vscode-docker",
"ms-python.python",
"visualstudioexptteam.vscodeintellicode",
"samuelcolvin.jinjahtml",
"redhat.vscode-yaml"
],

"remoteUser": "vscode"
}
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DBT_SNOW_DEV_ACCOUNT=
DBT_SNOW_DEV_WH=
DBT_SNOW_DEV_DB=
DBT_SNOW_SCH=
DBT_SNOW_USER=
DBT_SNOW_PRD_ACCOUNT=
DBT_SNOW_PRD_WH=
DBT_SNOW_PRD_DB=
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
target/
dbt_packages/
logs/
**/.DS_Store
.user.yml
venv/
env/
3 changes: 3 additions & 0 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[sqlfluff]

dialect = snowflake
16 changes: 16 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"innoverio.vscode-dbt-power-user",
"mechatroner.rainbow-csv",
"yzhang.markdown-all-in-one",
"redhat.vscode-yaml"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": [

]
}
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM mcr.microsoft.com/vscode/devcontainers/python:3.9

ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi

RUN pwd
RUN ls
COPY requirements.txt /tmp/
RUN pip3 install --upgrade pip
RUN pip3 install --requirement /tmp/requirements.txt

ENV DBT_PROFILES_DIR=/workspaces/new-python-wrench-demo
27 changes: 27 additions & 0 deletions profiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
config:
partial_parse: true

variables:
snow-dev: &snow-dev
type: snowflake
account: '{{ env_var("DBT_SNOW_DEV_ACCOUNT") }}'
warehouse: '{{ env_var("DBT_SNOW_DEV_WH") }}'
database: '{{ env_var("DBT_SNOW_DEV_DB") }}'
schema: '{{ env_var("DBT_SNOW_SCH") }}'
user: '{{ env_var("DBT_SNOW_DEV_USER") }}'
role: transformer
authenticator: externalbrowser
threads: 10

snow-prd: &snow-prd
<<: *snow-dev
account: '{{ env_var("DBT_SNOW_PRD_ACCOUNT") }}'
warehouse: '{{ env_var("DBT_SNOW_PRD_WH") }}'
database: '{{ env_var("DBT_SNOW_PRD_DB") }}'
schema: '{{ env_var("DBT_SNOW_SCH") }}'
user: '{{ env_var("DBT_SNOW_PRD_USER") }}'
python_wrench:
target: dev
outputs:
dev: *snow-dev
prd: *snow-prd
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dbt-snowflake==1.3.0b2
# extra features
sqlfluff~=1.2.1

0 comments on commit 8b98da4

Please sign in to comment.