Created
January 4, 2019 21:22
-
-
Save tconbeer/df0266ed1fbcd4a3775b587f83f45c6d to your computer and use it in GitHub Desktop.
Install DBT from Scratch on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
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
I've tried to install this via a Windows power shell in Pycharm and also via windows CMD prompt, it looks to instal until I try to run a project, I'm on a windows machine and collegues are on Macs who have no issue running command "dbt run", I get this error
run : The term 'run' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path
was included, verify that the path is correct and try again.
At line:1 char:1