DPT install : CLI and Adapters

by Mark Nielsen
Copyright Jan 2022


Just basic DPT for ELT processing. We assume mysql are both installed.
  1. Links
  2. PostgreSQL
  3. First Project
  4. Setup CLI environment
  5. Snowflake


Links



PostgreSQL

  • Setup dpt and postgresql
    
    	# you might need to execute this
    
    mkdir dbt
    cd dbt
    apt install python3.10-venv
    python3 -m venv dbt-env
    source dbt-env/bin/activate
    
    echo "alias env_dbt='source ~/dbt/dbt-env/bin/activate'" >> ~/.bashrc
    	  
    pip install dbt-postgres
    
    	  ## had some errors, saw a post to do this, the uninstalls did nothing
    pip uninstall black
    pip uninstall click
    pip install black
    pip install click
    
    	  
    	  # This worked
    dbt --version
    
           # login as root
    sudo bash	
    	  # Setup postgresql account
    echo "CREATE USER mark WITH PASSWORD 'mark';" | sudo -iu postgres psql
    echo " ALTER USER postgres PASSWORD 'mark'" | sudo -iu postgres psql
    
    echo " create database mark;" | sudo -iu postgres psql
    echo " ALTER DATABASE mark OWNER TO mark" | sudo -iu postgres psql
    	
    echo " create database mark_dev;" | sudo -iu postgres psql
    echo " ALTER DATABASE mark_dev OWNER TO mark" | sudo -iu postgres psql
    echo " create database mark_prod;" | sudo -iu postgres psql
    echo " ALTER DATABASE mark_prod OWNER TO mark" | sudo -iu postgres psql
    
    	  # log out of root
    exit
    
    	# This is very bad for security, just for this article. Do not do this on a prod system.
    export PGPASSWORD=mark
    echo 'export PGPASSWORD=mark' > ~/.bashrc
    	
    psql -U mark -h 127.0.0.1 -c "create table test1 (i int);"
    
    mkdir ~/.dpt
    cd ~/
    	
          
  • Setup in config file for postgresql. Run dbt init and edit file.

    Setting up a project

    The project is already setup called "dbt_test1". This is finished.

    Setup CLI environment

    We will be following the stuff on this url : https://discourse.getdbt.com/t/how-we-set-up-our-computers-for-working-on-dbt-projects/243

    Snowflake