Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Postgres adapter. #12

Merged
merged 4 commits into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"adapter": [
"snowflake",
"redshift",
"spark"
"spark",
"postgres"
],
"target_schema": "dev",
"run_git_init": [
Expand Down
29 changes: 29 additions & 0 deletions {{cookiecutter.project_slug}}/.config/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
21 changes: 21 additions & 0 deletions {{cookiecutter.project_slug}}/.config/user_profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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 %}