Skip to content

Instantly share code, notes, and snippets.

@tconbeer
Created January 4, 2019 21:22
Show Gist options
  • Save tconbeer/df0266ed1fbcd4a3775b587f83f45c6d to your computer and use it in GitHub Desktop.
Save tconbeer/df0266ed1fbcd4a3775b587f83f45c6d to your computer and use it in GitHub Desktop.
Install DBT from Scratch on Windows
# Any lines preceded by > can be typed or pasted directly into Powershell.
# This has been tested on Windows 10 and dbt v 0.12. Last updated Jan 4, 2019
# Before trying to follow this recipe, you need to set the Execution Policy
# You probably need to do this running Powershell as an admin
> Set-ExecutionPolicy RemoteSigned
# Next install chocolatey:
> iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Use Chocolatey to install python and git
> choco install python -y
> choco install git -y
# Optionally, use Chocolatey to install other useful apps
> choco install github-desktop -y
> choco install atom -y
> choco install datagrip -y
# You need to refresh your environment variables to add Python to your PATH.
# Do that by exiting Powershell or running:
> refreshenv
# At this point, you can/should continue using Powershell as your user, not an
# Administrator. Use pip to install pipenv for a virtual environment, but
# update pip first
> python -m pip install --upgrade pip
> pip install pipenv
# So far, we've just been installing python and other generally-useful modules
# Now we start installing dbt specifically. To prevent conflicts with other
# python packages, and to stay in sync across machines, we do this inside of a
# virtual environment, using pipenv
# Navigate to the directory that you want to contain your dbt projects.
> mkdir dbt
> cd dbt
##### IF USING AN EXISTING DBT PROJECT #####
# First clone the repository (assumes you're using git and Github)
# If this is a private repo, you'll have to authenticate git somehow
# (Github Desktop can do this for you)
> git clone https://github.com/my-org/my-dbt-project.git
# Install dbt from the Pipfile (assumes other contributors are using Pipenv)
> cd .\my-dbt-project\
> pipenv install
# Run dbt inside of pipenv by first running pipenv shell. Run dbt Help to
# confirm installation
> pipenv shell
>> dbt --help
##### IF CREATING A NEW DBT PROJECT #####
# In the master directory, install dbt using pipenv
> pipenv install dbt
# Run dbt inside of pipenv by first running pipenv shell. Run Help to confirm
# installation
> pipenv shell
>> dbt --help
# Create a new dbt project
>> dbt init my-dbt-project
# You will need to edit the profile in the .dbt directory that gets created elsewhere
# in order to connect to your database and run dbt. See
https://docs.getdbt.com/docs/configure-your-profile
@tconbeer
Copy link
Author

This gist is like 5 years old. Please use the official instructions at getdbt.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment