From 8382c6ff30abec0bc232109678fc38f47b2c69f6 Mon Sep 17 00:00:00 2001 From: Bernardo Chrispim Baron Date: Mon, 30 May 2022 12:26:15 -0300 Subject: [PATCH 1/4] Add Postgres adapter user profile --- .../.config/user_profiles.yml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/{{cookiecutter.project_slug}}/.config/user_profiles.yml b/{{cookiecutter.project_slug}}/.config/user_profiles.yml index fb8c3a7..0d0f620 100644 --- a/{{cookiecutter.project_slug}}/.config/user_profiles.yml +++ b/{{cookiecutter.project_slug}}/.config/user_profiles.yml @@ -70,3 +70,24 @@ default: # search_path: public # optional, not recommended # sslmode: [optional, set the sslmode used to connect to the database (in case this parameter is set, will look for ca in ~/.postgresql/root.crt)] {%- endif %} + + {%- if cookiecutter.adapter == "postgres" %} + # Additional Postgres options + # Find out more about Postgres config options here: + # https://docs.getdbt.com/reference/warehouse-profiles/postgres-profile + + # Replace the information below with your specific information + dbname: your_database_name + schema: {{ cookiecutter.target_schema }} + user: your_database_user_name + password: your_database_password + + host: localhost # your Postgres host name + port: 5432 + keepalives_idle: 0 # default 0, indicating the system default. See below + connect_timeout: 10 # default 10 seconds + # search_path: [optional, override the default postgres search_path] + # role: [optional, set the role dbt assumes when executing queries] + # sslmode: [optional, set the sslmode used to connect to the database] + + {%- endif %} From ebed58fa64901a08e897e70309a660f65e84f13c Mon Sep 17 00:00:00 2001 From: Bernardo Chrispim Baron Date: Mon, 30 May 2022 12:36:56 -0300 Subject: [PATCH 2/4] Add Postgres adapter profile. --- .../.config/profiles.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/{{cookiecutter.project_slug}}/.config/profiles.yml b/{{cookiecutter.project_slug}}/.config/profiles.yml index 5bbcda3..ed374e4 100644 --- a/{{cookiecutter.project_slug}}/.config/profiles.yml +++ b/{{cookiecutter.project_slug}}/.config/profiles.yml @@ -79,3 +79,32 @@ default: # search_path: public # optional, not recommended # sslmode: [optional, set the sslmode used to connect to the database (in case this parameter is set, will look for ca in ~/.postgresql/root.crt)] {%- endif %} + + {%- if cookiecutter.adapter == "postgres" %} + + # Set the DBT_DATABASE in your CI + database: {% raw %}"{{ env_var('DBT_DATABASE') }}"{% endraw %} + schema: {{ cookiecutter.target_schema }} + + # Set variable DBT_USER in your CI + user: {% raw %}"{{ env_var('DBT_USER') }}"{% endraw %} + + # Set variable DBT_PASSWORD in your CI + password: {% raw %}"{{ env_var('DBT_PASSWORD') }}"{% endraw %} + + # Additional Postgres options + # Find out more about Postgres config options here: + # https://docs.getdbt.com/reference/warehouse-profiles/postgres-profile + + # Set variable DBT_POSTGRES_HOST in your CI + host: {% raw %}"{{ env_var('DBT_POSTGRES_HOST') }}"{% endraw %} + port: 5432 + + keepalives_idle: 0 # default 0, indicating the system default. + connect_timeout: 10 # default 10 seconds + + # search_path: [optional, override the default postgres search_path] + # role: [optional, set the role dbt assumes when executing queries] + # sslmode: [optional, set the sslmode used to connect to the database] + + {%- endif %} From 0b053864217265ea7c30dea8ec8ff2acc0ef15e1 Mon Sep 17 00:00:00 2001 From: Bernardo Chrispim Baron Date: Mon, 30 May 2022 12:37:54 -0300 Subject: [PATCH 3/4] Remove comment excerpt taken from documentation. --- {{cookiecutter.project_slug}}/.config/user_profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/.config/user_profiles.yml b/{{cookiecutter.project_slug}}/.config/user_profiles.yml index 0d0f620..6404bfb 100644 --- a/{{cookiecutter.project_slug}}/.config/user_profiles.yml +++ b/{{cookiecutter.project_slug}}/.config/user_profiles.yml @@ -84,7 +84,7 @@ default: host: localhost # your Postgres host name port: 5432 - keepalives_idle: 0 # default 0, indicating the system default. See below + keepalives_idle: 0 # default 0, indicating the system default. connect_timeout: 10 # default 10 seconds # search_path: [optional, override the default postgres search_path] # role: [optional, set the role dbt assumes when executing queries] From aedc6cf1d0dbbdaa816c9d361b6b1ba60399ab42 Mon Sep 17 00:00:00 2001 From: Bernardo Chrispim Baron Date: Mon, 30 May 2022 12:41:34 -0300 Subject: [PATCH 4/4] Add Postgres as an option in adapter list --- cookiecutter.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 5f464e3..7153a7c 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -4,7 +4,8 @@ "adapter": [ "snowflake", "redshift", - "spark" + "spark", + "postgres" ], "target_schema": "dev", "run_git_init": [