Skip to content

Commit

Permalink
Merge branch 'main' into colin-rogers-dbt-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Jan 24, 2025
2 parents 8fa6b4a + 8b303eb commit f22d42c
Show file tree
Hide file tree
Showing 259 changed files with 20,380 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ body:
required: false
- label: dbt-bigquery
required: false
- label: dbt-postgres
required: false
- label: dbt-redshift
required: false
- label: dbt-spark
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/regression-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ body:
required: false
- label: dbt-bigquery
required: false
- label: dbt-postgres
required: false
- label: dbt-redshift
required: false
- label: dbt-spark
Expand Down
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ updates:
- "/dbt-athena"
- "/dbt-athena-community"
- "/dbt-bigquery"
- "/dbt-postgres"
- "/dbt-redshift"
- "/dbt-spark"
schedule:
Expand All @@ -19,6 +20,7 @@ updates:
- package-ecosystem: "docker"
directories:
- "/dbt-bigquery/docker"
- "/dbt-postgres/docker"
- "/dbt-redshift/docker"
- "/dbt-spark/docker"
schedule:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_generate-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
merge:
Expand Down
80 changes: 80 additions & 0 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
branch:
Expand Down Expand Up @@ -128,6 +129,85 @@ jobs:
if: ${{ inputs.python-version == '3.9' }} # we only run this for one version to run in series
working-directory: ./${{ inputs.package }}

integration-tests-postgres:
if: inputs.package == 'dbt-postgres'
runs-on: ${{ inputs.os }}
environment:
name: ${{ inputs.package }}
env:
POSTGRES_TEST_HOST: ${{ vars.POSTGRES_TEST_HOST }}
POSTGRES_TEST_PORT: ${{ vars.POSTGRES_TEST_PORT }}
POSTGRES_TEST_USER: ${{ vars.POSTGRES_TEST_USER }}
POSTGRES_TEST_PASS: ${{ secrets.POSTGRES_TEST_PASS }}
POSTGRES_TEST_DATABASE: ${{ vars.POSTGRES_TEST_DATABASE }}
POSTGRES_TEST_THREADS: ${{ vars.POSTGRES_TEST_THREADS }}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- ${{ vars.POSTGRES_TEST_PORT }}:5432
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: psql -f ./scripts/setup_test_database.sql
working-directory: ./dbt-postgres
env:
PGHOST: ${{ vars.POSTGRES_TEST_HOST }}
PGPORT: ${{ vars.POSTGRES_TEST_PORT }}
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
- uses: pypa/hatch@install
- run: hatch run integration-tests tests/functional --ddtrace
working-directory: ./${{ inputs.package }}

integration-tests-postgres-psycopg2-check:
if: inputs.package == 'dbt-postgres'
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- if: startsWith(inputs.os, 'macos')
run: brew install postgresql
- name: "Test psycopg2 - default"
run: scripts/psycopg2-check.sh
working-directory: ./${{ inputs.package }}
env:
PSYCOPG2_EXPECTED_NAME: psycopg2-binary
- name: "Test psycopg2 - invalid override"
run: scripts/psycopg2-check.sh
working-directory: ./${{ inputs.package }}
env:
DBT_PSYCOPG2_NAME: rubber-baby-buggy-bumpers
PSYCOPG2_EXPECTED_NAME: psycopg2-binary
- name: "Test psycopg2 - override"
run: scripts/psycopg2-check.sh
working-directory: ./${{ inputs.package }}
env:
DBT_PSYCOPG2_NAME: psycopg2
PSYCOPG2_EXPECTED_NAME: psycopg2-binary # we have not implemented the hook yet, so this doesn't work
- name: "Test psycopg2 - manual override"
# verify that the workaround documented in the `README.md` continues to work
run: scripts/psycopg2-check.sh
working-directory: ./${{ inputs.package }}
env:
PSYCOPG2_WORKAROUND: true
PSYCOPG2_EXPECTED_NAME: psycopg2

integration-tests-redshift:
if: ${{ inputs.package == 'dbt-redshift' }}
runs-on: ${{ inputs.os }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:
- "dbt-adapters"
- "dbt-athena"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
deploy-to:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
deploy-to:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
branch:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/_verify-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
branch:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
deploy-to:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
os: [ubuntu-22.04]
Expand All @@ -56,6 +57,7 @@ jobs:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
os: [ ubuntu-22.04 ]
Expand All @@ -76,6 +78,7 @@ jobs:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-spark"
os: [ubuntu-22.04]
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
rev: 7.1.1
hooks:
- id: flake8
exclude: dbt/adapters/events/adapter_types_pb2.py|tests/functional/|dbt-spark/tests/|dbt-bigquery/tests/|dbt-redshift/tests
exclude: dbt/adapters/events/adapter_types_pb2.py|tests/functional/|dbt-spark/tests/|dbt-bigquery/tests/|dbt-redshift/tests|dbt-postgres/tests
args:
- --max-line-length=99
- --select=E,F,W
Expand Down
3 changes: 3 additions & 0 deletions dbt-postgres/.changes/0.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Previous Releases
For information on prior major and minor releases, see their changelogs:
- [1.8](https://github.com/dbt-labs/dbt-postgres/blob/1.8.latest/CHANGELOG.md)
Empty file.
35 changes: 35 additions & 0 deletions dbt-postgres/.changes/1.9.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## dbt-postgres 1.9.0 - December 09, 2024

### Breaking Changes

- Drop support for Python 3.8 ([#161](https://github.com/dbt-labs/dbt-postgres/issues/161))

### Features

- Add tests for cross-database `cast` macro ([#76](https://github.com/dbt-labs/dbt-postgres/issues/76))
- Cross-database `date` macro ([#82](https://github.com/dbt-labs/dbt-postgres/issues/82))
- Add support for Python 3.12 ([#17](https://github.com/dbt-labs/dbt-postgres/issues/17))
- Allow configuring snapshot column names ([#144](https://github.com/dbt-labs/dbt-postgres/issues/144))
- Microbatch incremental strategy implementation: merge ([#149](https://github.com/dbt-labs/dbt-postgres/issues/149))
- Enable setting current value of dbt_valid_to ([#151](https://github.com/dbt-labs/dbt-postgres/issues/151))

### Fixes

- Fix the semicolon semantics for indexes while respecting other bug fix ([#85](https://github.com/dbt-labs/dbt-postgres/issues/85))
- Default to psycopg2-binary and allow overriding to psycopg2 via DBT_PSYCOPG2_NAME (restores previous behavior) ([#96](https://github.com/dbt-labs/dbt-postgres/issues/96))
- Fix `persist_docs` for `materialized_view` materializations. Previously, using this configuration with materialized view models would lead to an error. ([#120](https://github.com/dbt-labs/dbt-postgres/issues/120))

### Under the Hood

- Add support for experimental record/replay testing. ([#123](https://github.com/dbt-labs/dbt-postgres/issues/123))
- Updating changie.yaml to add contributors and PR links ([#109](https://github.com/dbt-labs/dbt-postgres/issues/109))

### Contributors
- [@dbeatty10](https://github.com/dbeatty10) ([#76](https://github.com/dbt-labs/dbt-postgres/issues/76), [#82](https://github.com/dbt-labs/dbt-postgres/issues/82))
- [@gshank](https://github.com/gshank) ([#144](https://github.com/dbt-labs/dbt-postgres/issues/144), [#151](https://github.com/dbt-labs/dbt-postgres/issues/151))
- [@leahwicz](https://github.com/leahwicz) ([#109](https://github.com/dbt-labs/dbt-postgres/issues/109))
- [@michelleark](https://github.com/michelleark) ([#149](https://github.com/dbt-labs/dbt-postgres/issues/149))
- [@mikealfare](https://github.com/mikealfare) ([#161](https://github.com/dbt-labs/dbt-postgres/issues/161), [#17](https://github.com/dbt-labs/dbt-postgres/issues/17), [#96](https://github.com/dbt-labs/dbt-postgres/issues/96))
- [@morsapaes](https://github.com/morsapaes) ([#120](https://github.com/dbt-labs/dbt-postgres/issues/120))
- [@peterallenwebb](https://github.com/peterallenwebb) ([#123](https://github.com/dbt-labs/dbt-postgres/issues/123))
- [@versusfacit](https://github.com/versusfacit) ([#85](https://github.com/dbt-labs/dbt-postgres/issues/85))
6 changes: 6 additions & 0 deletions dbt-postgres/.changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Migrate to a monorepo in dbt-adapters
time: 2024-12-01T12:22:44.407931-05:00
custom:
Author: mikealfare
Issue: "176"
132 changes: 132 additions & 0 deletions dbt-postgres/.changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
versionHeaderPath: ""
changelogPath: CHANGELOG.md
versionExt: md
envPrefix: "CHANGIE_"
versionFormat: '## dbt-postgres {{.Version}} - {{.Time.Format "January 02, 2006"}}'
kindFormat: '### {{.Kind}}'
changeFormat: |-
{{- $IssueList := list }}
{{- $changes := splitList " " $.Custom.Issue }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-postgres/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end -}}
- {{.Body}} ({{ range $index, $element := $IssueList }}{{if $index}}, {{end}}{{$element}}{{end}})
kinds:
- label: Breaking Changes
- label: Features
- label: Fixes
- label: Under the Hood
- label: Dependencies
changeFormat: |-
{{- $PRList := list }}
{{- $changes := splitList " " $.Custom.PR }}
{{- range $pullrequest := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-postgres/pull/nbr)" | replace "nbr" $pullrequest }}
{{- $PRList = append $PRList $changeLink }}
{{- end -}}
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
skipGlobalChoices: true
additionalChoices:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: PR
label: GitHub Pull Request Number (separated by a single space if multiple)
type: string
minLength: 1
- label: Security
changeFormat: |-
{{- $PRList := list }}
{{- $changes := splitList " " $.Custom.PR }}
{{- range $pullrequest := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-postgres/pull/nbr)" | replace "nbr" $pullrequest }}
{{- $PRList = append $PRList $changeLink }}
{{- end -}}
- {{.Body}} ({{ range $index, $element := $PRList }}{{if $index}}, {{end}}{{$element}}{{end}})
skipGlobalChoices: true
additionalChoices:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: PR
label: GitHub Pull Request Number (separated by a single space if multiple)
type: string
minLength: 1

newlines:
afterChangelogHeader: 1
afterKind: 1
afterChangelogVersion: 1
beforeKind: 1
endOfVersion: 1

custom:
- key: Author
label: GitHub Username(s) (separated by a single space if multiple)
type: string
minLength: 3
- key: Issue
label: GitHub Issue Number (separated by a single space if multiple)
type: string
minLength: 1


footerFormat: |
{{- $contributorDict := dict }}
{{- /* ensure all names in this list are all lowercase for later matching purposes */}}
{{- $core_team := splitList " " .Env.CORE_TEAM }}
{{- /* ensure we always skip snyk and dependabot in addition to the core team */}}
{{- $maintainers := list "dependabot[bot]" "snyk-bot"}}
{{- range $team_member := $core_team }}
{{- $team_member_lower := lower $team_member }}
{{- $maintainers = append $maintainers $team_member_lower }}
{{- end }}
{{- range $change := .Changes }}
{{- $authorList := splitList " " $change.Custom.Author }}
{{- /* loop through all authors for a single changelog */}}
{{- range $author := $authorList }}
{{- $authorLower := lower $author }}
{{- /* we only want to include non-core team contributors */}}
{{- if not (has $authorLower $maintainers)}}
{{- $changeList := splitList " " $change.Custom.Author }}
{{- $IssueList := list }}
{{- $changeLink := $change.Kind }}
{{- if or (eq $change.Kind "Dependencies") (eq $change.Kind "Security") }}
{{- $changes := splitList " " $change.Custom.PR }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-postgres/pull/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end -}}
{{- else }}
{{- $changes := splitList " " $change.Custom.Issue }}
{{- range $issueNbr := $changes }}
{{- $changeLink := "[#nbr](https://github.com/dbt-labs/dbt-postgres/issues/nbr)" | replace "nbr" $issueNbr }}
{{- $IssueList = append $IssueList $changeLink }}
{{- end -}}
{{- end }}
{{- /* check if this contributor has other changes associated with them already */}}
{{- if hasKey $contributorDict $author }}
{{- $contributionList := get $contributorDict $author }}
{{- $contributionList = concat $contributionList $IssueList }}
{{- $contributorDict := set $contributorDict $author $contributionList }}
{{- else }}
{{- $contributionList := $IssueList }}
{{- $contributorDict := set $contributorDict $author $contributionList }}
{{- end }}
{{- end}}
{{- end}}
{{- end }}
{{- /* no indentation here for formatting so the final markdown doesn't have unneeded indentations */}}
{{- if $contributorDict}}
### Contributors
{{- range $k,$v := $contributorDict }}
- [@{{$k}}](https://github.com/{{$k}}) ({{ range $index, $element := $v }}{{if $index}}, {{end}}{{$element}}{{end}})
{{- end }}
{{- end }}
Loading

0 comments on commit f22d42c

Please sign in to comment.