diff --git a/.changes/0.0.0.md b/.changes/0.0.0.md deleted file mode 100644 index 660fbd3..0000000 --- a/.changes/0.0.0.md +++ /dev/null @@ -1,3 +0,0 @@ -## 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) diff --git a/.changes/1.9.0-b1.md b/.changes/1.9.0-b1.md deleted file mode 100644 index 59bd21c..0000000 --- a/.changes/1.9.0-b1.md +++ /dev/null @@ -1,30 +0,0 @@ -## dbt-postgres 1.9.0-b1 - September 25, 2024 - -### 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)) - -### 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)) -- [@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) ([#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)) diff --git a/.changes/1.9.0/Features-20240430-185700.yaml b/.changes/1.9.0/Features-20240430-185700.yaml deleted file mode 100644 index 638d106..0000000 --- a/.changes/1.9.0/Features-20240430-185700.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Add tests for cross-database `cast` macro -time: 2024-04-30T18:57:00.437045-06:00 -custom: - Author: dbeatty10 - Issue: "76" diff --git a/.changes/1.9.0/Features-20240501-151856.yaml b/.changes/1.9.0/Features-20240501-151856.yaml deleted file mode 100644 index 2dda719..0000000 --- a/.changes/1.9.0/Features-20240501-151856.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Cross-database `date` macro -time: 2024-05-01T15:18:56.758715-06:00 -custom: - Author: dbeatty10 - Issue: 82 diff --git a/.changes/1.9.0/Features-20240731-210800.yaml b/.changes/1.9.0/Features-20240731-210800.yaml deleted file mode 100644 index b2fc1f0..0000000 --- a/.changes/1.9.0/Features-20240731-210800.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Add support for Python 3.12 -time: 2024-07-31T21:08:00.170999-04:00 -custom: - Author: mikealfare - Issue: "17" diff --git a/.changes/1.9.0/Features-20240903-160221.yaml b/.changes/1.9.0/Features-20240903-160221.yaml deleted file mode 100644 index 8409e24..0000000 --- a/.changes/1.9.0/Features-20240903-160221.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Allow configuring snapshot column names -time: 2024-09-03T16:02:21.069085-04:00 -custom: - Author: gshank - Issue: "144" diff --git a/.changes/1.9.0/Features-20240911-141416.yaml b/.changes/1.9.0/Features-20240911-141416.yaml deleted file mode 100644 index 990a09d..0000000 --- a/.changes/1.9.0/Features-20240911-141416.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: 'Microbatch incremental strategy implementation: merge' -time: 2024-09-11T14:14:16.538536-04:00 -custom: - Author: michelleark - Issue: "149" diff --git a/.changes/1.9.0/Fixes-20240514-193201.yaml b/.changes/1.9.0/Fixes-20240514-193201.yaml deleted file mode 100644 index 95ab246..0000000 --- a/.changes/1.9.0/Fixes-20240514-193201.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fix the semicolon semantics for indexes while respecting other bug fix -time: 2024-05-14T19:32:01.149383-07:00 -custom: - Author: versusfacit - Issue: "85" diff --git a/.changes/1.9.0/Fixes-20240605-202614.yaml b/.changes/1.9.0/Fixes-20240605-202614.yaml deleted file mode 100644 index b7ab8eb..0000000 --- a/.changes/1.9.0/Fixes-20240605-202614.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Fixes -body: Default to psycopg2-binary and allow overriding to psycopg2 via DBT_PSYCOPG2_NAME - (restores previous behavior) -time: 2024-06-05T20:26:14.801254-04:00 -custom: - Author: mikealfare - Issue: "96" diff --git a/.changes/1.9.0/Fixes-20240626-163930.yaml b/.changes/1.9.0/Fixes-20240626-163930.yaml deleted file mode 100644 index 37fcc56..0000000 --- a/.changes/1.9.0/Fixes-20240626-163930.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Fixes -body: Fix `persist_docs` for `materialized_view` materializations. Previously, using this configuration with materialized view models would lead to an error. -time: 2024-06-26T16:39:30.455995+02:00 -custom: - Author: morsapaes - Issue: "120" diff --git a/.changes/1.9.0/Under the Hood-20240716-172442.yaml b/.changes/1.9.0/Under the Hood-20240716-172442.yaml deleted file mode 100644 index 8777edb..0000000 --- a/.changes/1.9.0/Under the Hood-20240716-172442.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: Add support for experimental record/replay testing. -time: 2024-07-16T17:24:42.271859-04:00 -custom: - Author: peterallenwebb - Issue: "123" diff --git a/.changes/1.9.0/Under the Hood-20240731-075011.yaml b/.changes/1.9.0/Under the Hood-20240731-075011.yaml deleted file mode 100644 index 185c914..0000000 --- a/.changes/1.9.0/Under the Hood-20240731-075011.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Under the Hood -body: Updating changie.yaml to add contributors and PR links -time: 2024-07-31T07:50:11.875044-04:00 -custom: - Author: leahwicz - Issue: "109" diff --git a/.changes/header.tpl.md b/.changes/header.tpl.md deleted file mode 100644 index df8faa7..0000000 --- a/.changes/header.tpl.md +++ /dev/null @@ -1,6 +0,0 @@ -# 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). diff --git a/.changes/unreleased/.gitkeep b/.changes/unreleased/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/.changes/unreleased/Breaking Changes-20241016-175527.yaml b/.changes/unreleased/Breaking Changes-20241016-175527.yaml deleted file mode 100644 index d1e4df8..0000000 --- a/.changes/unreleased/Breaking Changes-20241016-175527.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Breaking Changes -body: Drop support for Python 3.8 -time: 2024-10-16T17:55:27.844499-04:00 -custom: - Author: mikealfare - Issue: "161" diff --git a/.changes/unreleased/Features-20240927-133708.yaml b/.changes/unreleased/Features-20240927-133708.yaml deleted file mode 100644 index b2dba33..0000000 --- a/.changes/unreleased/Features-20240927-133708.yaml +++ /dev/null @@ -1,6 +0,0 @@ -kind: Features -body: Enable setting current value of dbt_valid_to -time: 2024-09-27T13:37:08.808843-04:00 -custom: - Author: gshank - Issue: "151" diff --git a/.changie.yaml b/.changie.yaml deleted file mode 100644 index c5c2f06..0000000 --- a/.changie.yaml +++ /dev/null @@ -1,132 +0,0 @@ -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 }} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 02ed72d..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,3 +0,0 @@ -# This codeowners file is used to ensure all PRs require reviews from the adapters team - -* @dbt-labs/adapters diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 394de1f..538db3a 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -1,5 +1,5 @@ name: 🐞 Bug -description: Report a bug or an issue you've found with dbt-postgres +description: Report a bug or an issue you've found with dbt-cratedb2 title: "[Bug] " labels: ["bug", "triage"] body: @@ -13,9 +13,10 @@ body: description: > In other words, is this an error, flaw, failure or fault in our software? - If this is a bug that broke existing functionality that used to work, please open a regression issue. - If this is a bug experienced while using dbt Cloud, please report to [support](mailto:support@getdbt.com). - If this is a request for help or troubleshooting code in your own dbt project, please join our [dbt Community Slack](https://www.getdbt.com/community/join-the-community/) or open a [Discussion question](https://github.com/dbt-labs/docs.getdbt.com/discussions). + Please report it back to us so we can improve the situation. + + - [support](mailto:support@crate.io) + - https://cratedb.com/support Please search to see if an issue already exists for the bug you encountered. options: @@ -62,11 +63,13 @@ body: examples: - **OS**: Ubuntu 20.04 - **Python**: 3.11.6 (`python3 --version`) - - **dbt-postgres**: 1.0.0 (`dbt --version`) + - **dbt-core**: 1.8.7 (`dbt --version`) + - **dbt-cratedb2**: 0.1.0 (`dbt --version`) value: | - OS: - Python: - - dbt-postgres: + - dbt-core: + - dbt-cratedb2: render: markdown validations: required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 8d0995f..36fcf66 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: Ask the community for help - url: https://github.com/dbt-labs/docs.getdbt.com/discussions + url: https://community.cratedb.com/ about: Need help troubleshooting? Check out our guide on how to ask - - name: Contact dbt Cloud support - url: mailto:support@getdbt.com - about: Are you using dbt Cloud? Contact our support team for help! - - name: Participate in Discussions - url: https://github.com/dbt-labs/dbt-postgres/discussions - about: Do you have a Big Idea for dbt-postgres? Read open discussions, or start a new one + - name: Contact CrateDB Cloud and CrateDB Enterprise support + url: https://support.cratedb.com/ + about: Are you using CrateDB Cloud? Contact our support team for help! + - name: General CrateDB support information + url: https://cratedb.com/support + about: About CrateDB support contacts and knowledge diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index edc32c6..8bc058b 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -1,5 +1,5 @@ name: ✨ Feature -description: Propose a straightforward extension of dbt-postgres functionality +description: Propose a straightforward extension of dbt-cratedb2 functionality title: "[Feature] <title>" labels: ["enhancement", "triage"] body: @@ -14,15 +14,12 @@ body: We want to make sure that features are distinct and discoverable, so that other members of the community can find them and offer their thoughts. - Issues are the right place to request straightforward extensions of existing dbt-postgres functionality. - For "big ideas" about future capabilities of dbt-postgres, we ask that you open a - [discussion](https://github.com/dbt-labs/dbt-postgres/discussions/new?category=ideas) in the "Ideas" category instead. + Issues are the right place to request straightforward extensions of existing + dbt-cratedb2 functionality, or to share other ideas with us. options: - - label: I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations) - required: true - label: I have searched the existing issues, and I could not find an existing issue for this feature required: true - - label: I am requesting a straightforward extension of existing dbt-postgres functionality, rather than a Big Idea better suited to a discussion + - label: I am requesting a straightforward extension of existing dbt-cratedb2 functionality, rather than a Big Idea better suited to a discussion required: true - type: textarea attributes: diff --git a/.github/ISSUE_TEMPLATE/regression-report.yml b/.github/ISSUE_TEMPLATE/regression-report.yml index 73bfbe7..fbf5812 100644 --- a/.github/ISSUE_TEMPLATE/regression-report.yml +++ b/.github/ISSUE_TEMPLATE/regression-report.yml @@ -1,5 +1,5 @@ name: ☣️ Regression -description: Report a regression you've observed in a newer version of dbt-postgres +description: Report a regression you've observed in a newer version of dbt-cratedb2 title: "[Regression] <title>" labels: ["regression", "triage"] body: @@ -57,13 +57,13 @@ body: examples: - **OS**: Ubuntu 20.04 - **Python**: 3.11.6 (`python3 --version`) - - **dbt-postgres (working version)**: 1.1.0 (`dbt --version`) - - **dbt-postgres (regression version)**: 1.2.0 (`dbt --version`) + - **dbt-cratedb2 (working version)**: 0.1.0 (`dbt --version`) + - **dbt-cratedb2 (regression version)**: 0.2.0 (`dbt --version`) value: | - OS: - Python: - - dbt-postgres (working version): - - dbt-postgres (regression version): + - dbt-cratedb2 (working version): + - dbt-cratedb2 (regression version): render: markdown validations: required: true diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 26e27c4..c0ad18f 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,15 +1,9 @@ resolves # -[docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose) dbt-labs/docs.getdbt.com/# <!--- Include the number of the issue addressed by this PR above if applicable. PRs for code changes without an associated issue *will not be merged*. See CONTRIBUTING.md for more information. - - Include the number of the docs issue that was opened for this PR. If - this change has no user-facing implications, "N/A" suffices instead. New - docs tickets can be created by clicking the link above or by going to - https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose. --> ### Problem @@ -29,7 +23,7 @@ resolves # ### Checklist -- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md) and understand what's expected of me +- [ ] I have read [the contributing guide](https://github.com/crate-workbench/dbt-cratedb2/blob/main/CONTRIBUTING.md) and understand what's expected of me - [ ] I have run this code in development and it appears to resolve the stated issue - [ ] This PR includes tests, or tests are not required/relevant for this PR - [ ] This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX diff --git a/.github/scripts/psycopg2-check.sh b/.github/scripts/psycopg2-check.sh deleted file mode 100755 index faee902..0000000 --- a/.github/scripts/psycopg2-check.sh +++ /dev/null @@ -1,20 +0,0 @@ -python -m venv venv -source venv/bin/activate -python -m pip install . - -if [[ "$PSYCOPG2_WORKAROUND" == true ]]; then - if [[ $(pip show psycopg2-binary) ]]; then - PSYCOPG2_VERSION=$(pip show psycopg2-binary | grep Version | cut -d " " -f 2) - pip uninstall -y psycopg2-binary - pip install psycopg2==$PSYCOPG2_VERSION - fi -fi - -PSYCOPG2_NAME=$((pip show psycopg2 || pip show psycopg2-binary) | grep Name | cut -d " " -f 2) -if [[ "$PSYCOPG2_NAME" != "$PSYCOPG2_EXPECTED_NAME" ]]; then - echo -e 'Expected: "$PSYCOPG2_EXPECTED_NAME" but found: "$PSYCOPG2_NAME"' - exit 1 -fi - -deactivate -rm -r ./venv diff --git a/.github/workflows/changelog-entry-check.yml b/.github/workflows/changelog-entry-check.yml deleted file mode 100644 index 889c099..0000000 --- a/.github/workflows/changelog-entry-check.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Changelog entry check - -on: - pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - synchronize - -defaults: - run: - shell: bash - -permissions: - contents: read - pull-requests: write - -jobs: - changelog-entry-check: - uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main - with: - changelog_comment: >- - Thank you for your pull request! We could not find a changelog entry for this change. - For details on how to document a change, see the - [dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md). - skip_label: "Skip Changelog" - secrets: inherit diff --git a/.github/workflows/docs-issue.yml b/.github/workflows/docs-issue.yml deleted file mode 100644 index f49cf51..0000000 --- a/.github/workflows/docs-issue.yml +++ /dev/null @@ -1,41 +0,0 @@ -# **what?** -# Open an issue in docs.getdbt.com when an issue is labeled `user docs` and closed as completed - -# **why?** -# To reduce barriers for keeping docs up to date - -# **when?** -# When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed. - - -name: Open issues in docs.getdbt.com repo when an issue is labeled -run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}" - -on: - issues: - types: [labeled, closed] - -defaults: - run: - shell: bash - -permissions: - issues: write # comments on issues - -jobs: - open_issues: - # we only want to run this when the issue is closed as completed and the label `user docs` has been assigned. - # If this logic does not exist in this workflow, it runs the - # risk of duplicaton of issues being created due to merge and label both triggering this workflow to run and neither having - # generating the comment before the other runs. This lives here instead of the shared workflow because this is where we - # decide if it should run or not. - if: | - (github.event.issue.state == 'closed' && github.event.issue.state_reason == 'completed') && ( - (github.event.action == 'closed' && contains(github.event.issue.labels.*.name, 'user docs')) || - (github.event.action == 'labeled' && github.event.label.name == 'user docs')) - uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main - with: - issue_repository: "dbt-labs/docs.getdbt.com" - issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}" - issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated." - secrets: inherit diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 304c139..4a92868 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -140,49 +140,3 @@ jobs: POSTGRES_TEST_PASS: password POSTGRES_TEST_DATABASE: dbt POSTGRES_TEST_THREADS: 4 - - psycopg2-check: - name: "Test psycopg2 build version" - runs-on: ${{ matrix.platform }} - strategy: - fail-fast: false - matrix: - platform: [ubuntu-22.04, macos-14] - python-version: ["3.9", "3.12"] - steps: - - name: "Check out repository" - uses: actions/checkout@v4 - - - name: "Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: "Install postgresql on MacOS" - if: ${{ matrix.platform == 'macos-14' }} - run: | - brew install postgresql - - - name: "Test psycopg2 name - default" - run: .github/scripts/psycopg2-check.sh - env: - PSYCOPG2_EXPECTED_NAME: psycopg2-binary - - - name: "Test psycopg2 name - invalid override" - run: .github/scripts/psycopg2-check.sh - env: - DBT_PSYCOPG2_NAME: rubber-baby-buggy-bumpers - PSYCOPG2_EXPECTED_NAME: psycopg2-binary - - - name: "Test psycopg2 name - override" - run: .github/scripts/psycopg2-check.sh - 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 name - manual override" - # verify that the workaround documented in the `README.md` continues to work - run: .github/scripts/psycopg2-check.sh - env: - PSYCOPG2_WORKAROUND: true - PSYCOPG2_EXPECTED_NAME: psycopg2 diff --git a/.github/workflows/release-internal.yml b/.github/workflows/release-internal.yml deleted file mode 100644 index c272b80..0000000 --- a/.github/workflows/release-internal.yml +++ /dev/null @@ -1,50 +0,0 @@ -# What? -# -# Tag and release an arbitrary ref. Uploads to an internal archive for further processing. -# -# How? -# -# After checking out and testing the provided ref, the image is built and uploaded. -# -# When? -# -# Manual trigger. - -name: "Release internal patch" - -on: - workflow_dispatch: - inputs: - ref: - description: "The ref (sha or branch name) to use" - type: string - default: "main" - required: true - package_test_command: - description: "Package test command" - type: string - default: "python -c \"import dbt.adapters.postgres\"" - required: true - skip_tests: - description: "Should the tests be skipped? (default to false)" - type: boolean - required: true - default: false - -defaults: - run: - shell: "bash" - -jobs: - invoke-reusable-workflow: - name: "Build and Release Internally" - - uses: "dbt-labs/dbt-release/.github/workflows/internal-archive-release.yml@main" - - with: - package_test_command: "${{ inputs.package_test_command }}" - dbms_name: "postgres" - ref: "${{ inputs.ref }}" - skip_tests: "${{ inputs.skip_tests }}" - - secrets: "inherit" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index 75a14dd..0000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,30 +0,0 @@ -# **what?** -# For issues that have been open for awhile without activity, label -# them as stale with a warning that they will be closed out. If -# anyone comments to keep the issue open, it will automatically -# remove the stale label and keep it open. - -# Stale label rules: -# awaiting_response, more_information_needed -> 90 days -# good_first_issue, help_wanted -> 360 days (a year) -# tech_debt -> 720 (2 years) -# all else defaults -> 180 days (6 months) - -# **why?** -# To keep the repo in a clean state from issues that aren't relevant anymore - -# **when?** -# Once a day - -name: "Close stale issues and PRs" -on: - schedule: - - cron: "30 1 * * *" - -permissions: - issues: write - pull-requests: write - -jobs: - stale: - uses: dbt-labs/actions/.github/workflows/stale-bot-matrix.yml@main diff --git a/.gitignore b/.gitignore index b8d4acc..d129355 100644 --- a/.gitignore +++ b/.gitignore @@ -157,7 +157,7 @@ cython_debug/ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +.idea/ # testing artifacts /logs diff --git a/CHANGELOG.md b/CHANGELOG.md index fc95b95..20e5988 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,41 +2,8 @@ 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). +and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## dbt-postgres 1.9.0-b1 - September 25, 2024 +## 0.0.1 - November 12, 2024 -### 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)) - -### 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)) -- [@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) ([#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)) - - -## 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) +- Friendly fork from dbt-postgres 1.9.0-b1 - September 25, 2024 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d92515..0d62177 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing to `dbt-postgres` +# Contributing to `dbt-cratedb2` - [About this document](#about-this-document) - [Getting the code](#getting-the-code) @@ -10,8 +10,8 @@ ## About this document -This document is a guide for anyone interested in contributing to `dbt-postgres`. -It outlines how to install `dbt-postgres` for development, +This document is a guide for anyone interested in contributing to `dbt-cratedb2`. +It outlines how to install `dbt-cratedb2` for development, run tests locally, update documentation, and submit pull requests. This guide assumes users are developing on a Linux or MacOS system. The following utilities are needed or will be installed in this guide: @@ -19,19 +19,18 @@ The following utilities are needed or will be installed in this guide: - `pip` - `virturalenv` - `git` -- `changie` If local functional testing is required, then a database instance and appropriate credentials are also required. -In addition to this guide, users are highly encouraged to read the `dbt-core` -[CONTRIBUTING.md](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md). -Almost all information there is applicable here. +In addition to this guide, users are highly encouraged to read the [CrateDB +contribution guidelines](https://github.com/crate/crate/blob/master/CONTRIBUTING.rst). +Almost all information there is also applicable here. ## Getting the code -`git` is required to download, modify, and sync the `dbt-postgres` code. +`git` is required to download, modify, and sync the `dbt-cratedb2` code. There are several ways to install Git. For MacOS: - Install [Xcode](https://developer.apple.com/support/xcode/) @@ -39,27 +38,27 @@ There are several ways to install Git. For MacOS: ### External contributors -Contributors external to the `dbt-labs` GitHub organization can contribute to `dbt-postgres` -by forking the `dbt-postgres` repository. For more on forking, check out the +Contributors external to the `crate` GitHub organization can contribute to `dbt-cratedb2` +by forking the `dbt-cratedb2` repository. For more on forking, check out the [GitHub docs on forking](https://help.github.com/en/articles/fork-a-repo). To contribute: -1. Fork the `dbt-labs/dbt-postgres` repository (e.g. `{forked-org}/dbt-postgres`) -2. Clone `{forked-org}/dbt-postgres` locally +1. Fork the `crate-workbench/dbt-cratedb2` repository (e.g. `{forked-org}/dbt-cratedb2`) +2. Clone `{forked-org}/dbt-cratedb2` locally 3. Check out a new branch locally 4. Make changes in the new branch -5. Push the new branch to `{forked-org}/dbt-postgres` -6. Open a pull request in `dbt-labs/dbt-postgres` to merge `{forked-org}/dbt-postgres/{new-branch}` into `main` +5. Push the new branch to `{forked-org}/dbt-cratedb2` +6. Open a pull request in `crate-workbench/dbt-cratedb2` to merge `{forked-org}/dbt-cratedb2/{new-branch}` into `main` -### dbt Labs contributors +### CrateDB contributors -Contributors in the `dbt Labs` GitHub organization have push access to the `dbt-postgres` repo. -Rather than forking `dbt-labs/dbt-postgres`, use `dbt-labs/dbt-postgres` directly. To contribute: +Contributors in the `crate` GitHub organization have push access to the `dbt-cratedb2` repo. +Rather than forking `crate-workbench/dbt-cratedb2`, use `crate-workbench/dbt-cratedb2` directly. To contribute: -1. Clone `dbt-labs/dbt-postgres` locally +1. Clone `crate-workbench/dbt-cratedb2` locally 2. Check out a new branch locally 3. Make changes in the new branch -4. Push the new branch to `dbt-labs/dbt-postgres` -5. Open a pull request in `dbt-labs/dbt-postgres` to merge `{new-branch}` into `main` +4. Push the new branch to `crate-workbench/dbt-cratedb2` +5. Open a pull request in `crate-workbench/dbt-cratedb2` to merge `{new-branch}` into `main` ## Developing @@ -88,13 +87,13 @@ Rather than forking `dbt-labs/dbt-postgres`, use `dbt-labs/dbt-postgres` directl hatch run <command> ``` -When `dbt-postgres` is installed this way, any changes made to the `dbt-postgres` source code +When `dbt-cratedb2` is installed this way, any changes made to the `dbt-cratedb2` source code will be reflected in the virtual environment immediately. ## Testing -`dbt-postgres` contains [code quality checks](https://github.com/dbt-labs/dbt-postgres/tree/main/.pre-commit-config.yaml), [unit tests](https://github.com/dbt-labs/dbt-postgres/tree/main/tests/unit), -and [functional tests](https://github.com/dbt-labs/dbt-postgres/tree/main/tests/functional). +`dbt-cratedb2` contains [code quality checks](https://github.com/crate-workbench/dbt-cratedb2/tree/main/.pre-commit-config.yaml), [unit tests](https://github.com/crate-workbench/dbt-cratedb2/tree/main/tests/unit), +and [functional tests](https://github.com/crate-workbench/dbt-cratedb2/tree/main/tests/functional). ### Code quality @@ -124,7 +123,7 @@ hatch run unit-tests tests/unit/$test_file_name.py::$test_class_name::$test_meth Functional tests require a database to test against. There are two primary ways to run functional tests: -- Tests will run automatically against a dbt Labs owned database during PR checks +- Tests on CI will run automatically against a configured database during PR checks - Tests can be run locally by configuring a `test.env` file with appropriate `ENV` variables: ```shell cp test.env.example test.env @@ -184,37 +183,17 @@ hatch shell ### User documentation -Many changes will require an update to `dbt-postgres` user documentation. -All contributors, whether internal or external, are encouraged to open an issue or PR -in the docs repo when submitting user-facing changes. Here are some relevant links: - -- [User docs](https://docs.getdbt.com/) - - [Warehouse Profile](https://docs.getdbt.com/reference/warehouse-profiles/) - - [Resource Configs](https://docs.getdbt.com/reference/resource-configs/) -- [User docs repo](https://github.com/dbt-labs/docs.getdbt.com) - -### CHANGELOG entry - -`dbt-postgres` uses [changie](https://changie.dev) to generate `CHANGELOG` entries. -Follow the steps to [install `changie`](https://changie.dev/guide/installation/). - -Once changie is installed and the PR is created, run: - ```shell - changie new - ``` -`changie` will walk through the process of creating a changelog entry. -Remember to commit and push the file that's created. - -> **_NOTE:_** Do not edit the `CHANGELOG.md` directly. -> Any modifications will be lost by the consolidation process. +Many changes will require an update to `dbt-cratedb2` user documentation +within the `docs/` folder in this repository. Please make sure your patches +are complete by including relevant updates. ## Submitting a pull request ### Signing the CLA -> **_NOTE:_** All contributors to `dbt-postgres` must sign the -> [Contributor License Agreement](https://docs.getdbt.com/docs/contributor-license-agreements)(CLA). +> **_NOTE:_** All contributors to `dbt-cratedb2` must sign the +> [Contributor License Agreement](https://cratedb.com/developers/community/contribute)(CLA). Maintainers will be unable to merge contributions until the contributor signs the CLA. This is a one time requirement, not a per-PR requirement. @@ -222,11 +201,11 @@ Even without a CLA, anyone is welcome to open issues and comment on existing iss ### Opening a pull request -A `dbt-postgres` maintainer will be assigned to review each PR based on priority and capacity. +A `dbt-cratedb2` maintainer will be assigned to review each PR based on priority and capacity. They may suggest code revisions for style and clarity or they may request additional tests. -These are good things! dbt Labs believes that contributing high-quality code is a collaborative effort. -The same process is followed whether the contributor is external or another `dbt-postgres` maintainer. +These are good things! Crate.io believes that contributing high-quality code is a collaborative effort. +The same process is followed whether the contributor is external or another `dbt-cratedb2` maintainer. Once all tests are passing and the PR has been approved by the appropriate code owners, -a `dbt-postgres` maintainer will merge the changes into `main`. +a `dbt-cratedb2` maintainer will merge the changes into `main`. And that's it! Happy developing :tada: diff --git a/LICENSE b/LICENSE index 10a79fa..d9a10c0 100644 --- a/LICENSE +++ b/LICENSE @@ -174,28 +174,3 @@ of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2024 dbt Labs, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/README.md b/README.md index 8053af1..157234c 100644 --- a/README.md +++ b/README.md @@ -2,28 +2,44 @@ <img src="https://raw.githubusercontent.com/dbt-labs/dbt/ec7dee39f793aa4f7dd3dae37282cc87664813e4/etc/dbt-logo-full.svg" alt="dbt logo" width="500"/> </p> <p align="center"> - <a href="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml"> - <img src="https://github.com/dbt-labs/dbt-core/actions/workflows/main.yml/badge.svg?event=push" alt="CI Badge"/> + <a href="https://github.com/crate-workbench/dbt-cratedb2/actions/workflows/unit-tests.yml"> + <img src="https://github.com/crate-workbench/dbt-cratedb2/actions/workflows/unit-tests.yml/badge.svg?event=push" alt="CI Badge » Unit Tests"/> + </a> + <a href="https://github.com/crate-workbench/dbt-cratedb2/actions/workflows/integration-tests.yml"> + <img src="https://github.com/crate-workbench/dbt-cratedb2/actions/workflows/integration-tests.yml/badge.svg?event=push" alt="CI Badge » Integration Tests"/> </a> </p> -**[dbt](https://www.getdbt.com/)** enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. +## dbt-cratedb2 -dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis. +The `dbt-cratedb2` package contains all the code enabling [dbt] to work with a +[CrateDB] database. + +Because CrateDB is PostgreSQL-compatible, dbt-cratedb2 +heavily builds upon the canonical [dbt-postgres] adapter. +For more information on using dbt with CrateDB, +consult [the docs](https://docs.getdbt.com/docs/profile-cratedb). -## dbt-postgres +## About dbt -The `dbt-postgres` package contains all of the code enabling dbt to work with a Postgres database. For -more information on using dbt with Postgres, consult [the docs](https://docs.getdbt.com/docs/profile-postgres). +dbt enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications. + +dbt is the T in ELT. Organize, cleanse, denormalize, filter, rename, and pre-aggregate the raw data in your warehouse so that it's ready for analysis. ## Getting started - [Install dbt](https://docs.getdbt.com/docs/installation) - Read the [introduction](https://docs.getdbt.com/docs/introduction/) and [viewpoint](https://docs.getdbt.com/docs/about/viewpoint/) +## Installation +Install dbt-cratedb2. +```shell +pip install 'dbt-cratedb2 @ git+https://github.com/crate-workbench/dbt-cratedb2.git' +``` + ### `psycopg2-binary` vs. `psycopg2` -By default, `dbt-postgres` installs `psycopg2-binary`. This is great for development, and even testing, as it does not require any OS dependencies; it's a pre-built wheel. However, building `psycopg2` from source will grant performance improvements that are desired in a production environment. In order to install `psycopg2`, use the following steps: +By default, `dbt-cratedb2` installs `psycopg2-binary`. This is great for development, and even testing, as it does not require any OS dependencies; it's a pre-built wheel. However, building `psycopg2` from source will grant performance improvements that are desired in a production environment. In order to install `psycopg2`, use the following steps: ```bash if [[ $(pip show psycopg2-binary) ]]; then @@ -38,18 +54,15 @@ This ensures the version of `psycopg2` will match that of `psycopg2-binary`. ## Contribute -See `CONTRIBUTING.md` for a detailed overview of contributing a code change to this adapter. - -## Join the dbt Community - -- Be part of the conversation in the [dbt Community Slack](http://community.getdbt.com/) -- Read more on the [dbt Community Discourse](https://discourse.getdbt.com) +- Want to report a bug or request a feature? Let us know by [opening an issue](https://github.com/crate-workbench/dbt-cratedb2/issues/new) +- Want to help us build dbt-cratedb2? Check out the [contributing guide](https://github.com/crate-workbench/dbt-cratedb2/blob/main/CONTRIBUTING.md) +- Join the community on the [CrateDB Community Discourse](https://community.cratedb.com/) -## Reporting bugs and contributing code +## Code of Conduct -- Want to report a bug or request a feature? Let us know on [Slack](http://community.getdbt.com/), or open [an issue](https://github.com/dbt-labs/dbt-postgres/issues/new) -- Want to help us build dbt? Check out the [Contributing Guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md) +Everyone interacting with Crate.io's codebases, issue trackers, chat rooms, and mailing lists, please follow the [CrateDB Code of Conduct](https://github.com/crate/crate/blob/master/CODE_OF_CONDUCT.md). -## Code of Conduct -Everyone interacting in the dbt project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [dbt Code of Conduct](https://community.getdbt.com/code-of-conduct). +[CrateDB]: https://github.com/crate/crate +[dbt]: https://www.getdbt.com/ +[dbt-postgres]: https://github.com/dbt-labs/dbt-postgres diff --git a/dbt/adapters/postgres/__version__.py b/dbt/adapters/postgres/__version__.py index a4077ff..b2c74a1 100644 --- a/dbt/adapters/postgres/__version__.py +++ b/dbt/adapters/postgres/__version__.py @@ -1 +1 @@ -version = "1.9.0b1" +version = "0.0.1dev0" diff --git a/dbt/include/postgres/macros/materializations/incremental_strategies.sql b/dbt/include/postgres/macros/materializations/incremental_strategies.sql index 1d37366..012b617 100644 --- a/dbt/include/postgres/macros/materializations/incremental_strategies.sql +++ b/dbt/include/postgres/macros/materializations/incremental_strategies.sql @@ -14,7 +14,7 @@ {% if arg_dict["unique_key"] %} {% do return(adapter.dispatch('get_incremental_merge_sql', 'dbt')(arg_dict)) %} {% else %} - {{ exceptions.raise_compiler_error("dbt-postgres 'microbatch' requires a `unique_key` config") }} + {{ exceptions.raise_compiler_error("dbt-cratedb2 'microbatch' requires a `unique_key` config") }} {% endif %} {% endmacro %} diff --git a/docker/Dockerfile b/docker/Dockerfile index cfbc81a..c3824a8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,7 +25,7 @@ ENV LANG=C.UTF-8 RUN python -m pip install --upgrade "pip==24.0" "setuptools==69.2.0" "wheel==0.43.0" --no-cache-dir -FROM base AS dbt-postgres +FROM base AS dbt-cratedb2 ARG commit_ref=main @@ -34,4 +34,4 @@ HEALTHCHECK CMD dbt --version || exit 1 WORKDIR /usr/app/dbt/ ENTRYPOINT ["dbt"] -RUN python -m pip install --no-cache-dir "dbt-postgres @ git+https://github.com/dbt-labs/dbt-postgres@${commit_ref}" +RUN python -m pip install --no-cache-dir "dbt-cratedb2 @ git+https://github.com/crate-workbench/dbt-cratedb2@${commit_ref}" diff --git a/docker/README.md b/docker/README.md index f571eeb..120da7d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -3,38 +3,38 @@ This docker file is suitable for building dbt Docker images locally or using wit ## Building an image: -This Dockerfile can create images for the following target: `dbt-postgres` +This Dockerfile can create images for the following target: `dbt-cratedb2` In order to build a new image, run the following docker command. ```shell -docker build --tag <your_image_name> --target dbt-postgres <path/to/dockerfile> +docker build --tag <your_image_name> --target dbt-cratedb2 <path/to/dockerfile> ``` --- > **Note:** Docker must be configured to use [BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) in order for images to build properly! --- -By default the image will be populated with the latest version of `dbt-postgres` on `main`. +By default the image will be populated with the latest version of `dbt-cratedb2` on `main`. If you need to use a different version you can specify it by git ref using the `--build-arg` flag: ```shell docker build --tag <your_image_name> \ - --target dbt-postgres \ + --target dbt-cratedb2 \ --build-arg commit_ref=<commit_ref> \ <path/to/dockerfile> ``` ### Examples: -To build an image named "my-dbt" that supports Postgres using the latest releases: +To build an image named "my-dbt" that supports CrateDB using the latest releases: ```shell -docker build --tag my-dbt --target dbt-postgres . +docker build --tag my-dbt --target dbt-cratedb2 . ``` -To build an image named "my-other-dbt" that supports Postgres using the adapter version 1.8.0: +To build an image named "my-other-dbt" that supports CrateDB using the adapter version 1.8.0: ```shell cd dbt-core/docker docker build \ --tag my-other-dbt \ - --target dbt-postgres \ + --target dbt-cratedb2 \ --build-arg commit_ref=v1.8.0 \ . ``` diff --git a/docker/dev.Dockerfile b/docker/dev.Dockerfile index 280ff39..b8c8c08 100644 --- a/docker/dev.Dockerfile +++ b/docker/dev.Dockerfile @@ -39,7 +39,7 @@ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 RUN python -m pip install --upgrade "hatch==1.13.0" --no-cache-dir --compile -FROM base AS dbt-postgres-dev +FROM base AS dbt-cratedb2-dev HEALTHCHECK CMD python --version || exit 1 diff --git a/docs/backlog.md b/docs/backlog.md new file mode 100644 index 0000000..bec5cfa --- /dev/null +++ b/docs/backlog.md @@ -0,0 +1,29 @@ +# dbt-cratedb2 backlog + +## Bugs? +- [o] 'Database Error\n Validation Failed: 1: this action would add [4] total shards, but this cluster currently has [1000]/[1000] maximum shards open; + ``` + [2024-11-12T02:02:47,562][INFO ][i.c.m.c.RenameTableClusterStateExecutor] [Olperer] renaming table 'test17313769673008283614_test_basic.ephemeral_summary__dbt_tmp' to 'test17313769673008283614_test_basic.ephemeral_summary' + [2024-11-12T02:02:47,677][INFO ][o.e.c.r.a.AllocationService] [Olperer] Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[test17313769673008283614_test_basic.ephemeral_summary][3], [test17313769673008283614_test_basic.ephemeral_summary][2], [test17313769673008283614_test_basic.ephemeral_summary][1], [test17313769673008283614_test_basic.ephemeral_summary][0]]]). + ``` + +## Testing +From `release-internal.yml` GHA workflow. +```shell +python -c "import dbt.adapters.cratedb" +``` + +## Testing (from upstream) + +### Goals of moving tests to pytest +* Readability +* Modularity +* Easier to create and debug +* Ability to create a project for external debugging + +### TODO +* Create the ability to export a project +* Explore using: + * https://github.com/pytest-docker-compose/pytest-docker-compose or + * https://github.com/avast/pytest-docker for automatically managing a CrateDB instance running in a docker container +* Track test coverage (https://pytest-cov.readthedocs.io/en/latest) diff --git a/pyproject.toml b/pyproject.toml index f3aa52c..73e6e5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,18 +1,18 @@ [project] dynamic = ["version"] -name = "dbt-postgres" -description = "The set of adapter protocols and base functionality that supports integration with dbt-core" +name = "dbt-cratedb2" +description = "dbt adapter for CrateDB 5.x, derived from dbt-postgres" readme = "README.md" -keywords = ["dbt", "adapter", "adapters", "database", "elt", "dbt-core", "dbt Core", "dbt Cloud", "dbt Labs", "postgres"] +keywords = ["dbt", "adapter", "cratedb", "adapters", "database", "elt", "dbt-core", "dbt-adapter", "postgresql"] requires-python = ">=3.9.0" authors = [ - { name = "dbt Labs", email = "info@dbtlabs.com" }, + { name = "Crate.io", email = "office@crate.io" }, ] maintainers = [ - { name = "dbt Labs", email = "info@dbtlabs.com" }, + { name = "Crate.io", email = "office@crate.io" }, ] classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 3 - Alpha", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", @@ -29,14 +29,15 @@ dependencies = [ "dbt-core>=1.8.0", # installed via dbt-adapters but used directly "dbt-common>=1.0.4,<2.0", + # "dbt-postgres==1.9.0b1", "agate>=1.0,<2.0", ] [project.urls] -Homepage = "https://github.com/dbt-labs/dbt-postgres" -Documentation = "https://docs.getdbt.com" -Repository = "https://github.com/dbt-labs/dbt-postgres.git" -Issues = "https://github.com/dbt-labs/dbt-postgres/issues" -Changelog = "https://github.com/dbt-labs/dbt-postgres/blob/main/CHANGELOG.md" +Homepage = "https://github.com/crate-workbench/dbt-cratedb2" +Documentation = "https://dbt-cratedb2.readthedocs.io/" +Repository = "https://github.com/crate-workbench/dbt-cratedb2.git" +Issues = "https://github.com/crate-workbench/dbt-cratedb2/issues" +Changelog = "https://github.com/crate-workbench/dbt-cratedb2/blob/main/CHANGELOG.md" [build-system] requires = ["hatchling"] @@ -71,14 +72,14 @@ DBT_TEST_USER_3 = "dbt_test_user_3" [tool.hatch.envs.default.scripts] setup = "pre-commit install" code-quality = "pre-commit run --all-files" -unit-tests = "python -m pytest {args:tests/unit}" -integration-tests = "python -m pytest {args:tests/functional}" +unit-tests = "python -m pytest -vvv {args:tests/unit}" +integration-tests = "python -m pytest -vvv {args:tests/functional}" docker-dev = [ "echo Does not support integration testing, only development and unit testing. See issue https://github.com/dbt-labs/dbt-postgres/issues/99", - "docker build -f docker/dev.Dockerfile -t dbt-postgres-dev .", - "docker run --rm -it --name dbt-postgres-dev -v $(pwd):/opt/code dbt-postgres-dev", + "docker build -f docker/dev.Dockerfile -t dbt-cratedb2-dev .", + "docker run --rm -it --name dbt-cratedb2-dev -v $(pwd):/opt/code dbt-cratedb2-dev", ] -docker-prod = "docker build -f docker/Dockerfile -t dbt-postgres ." +docker-prod = "docker build -f docker/Dockerfile -t dbt-cratedb2 ." [tool.hatch.envs.build] detached = true @@ -95,12 +96,12 @@ check-all = [ check-wheel = [ "twine check dist/*", "find ./dist/dbt_postgres-*.whl -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/", - "pip freeze | grep dbt-postgres", + "pip freeze | grep dbt-cratedb2", ] check-sdist = [ "check-wheel-contents dist/*.whl --ignore W007,W008", "find ./dist/dbt_postgres-*.gz -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/", - "pip freeze | grep dbt-postgres", + "pip freeze | grep dbt-cratedb2", ] [tool.pytest] diff --git a/tests/functional/README.md b/tests/functional/README.md deleted file mode 100644 index b5aa542..0000000 --- a/tests/functional/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# This is where we are putting the pytest conversions of test/integration - -# Goals of moving tests to pytest - * Readability - * Modularity - * Easier to create and debug - * Ability to create a project for external debugging - -# TODO - * Create the ability to export a project - * Explore using: - * https://github.com/pytest-docker-compose/pytest-docker-compose or - * https://github.com/avast/pytest-docker for automatically managing a postgres instance running in a docker container - * Track test coverage (https://pytest-cov.readthedocs.io/en/latest) diff --git a/tests/functional/adapter/test_query_comment.py b/tests/functional/adapter/test_query_comment.py index ea2ddea..3f2aced 100644 --- a/tests/functional/adapter/test_query_comment.py +++ b/tests/functional/adapter/test_query_comment.py @@ -20,7 +20,7 @@ class TestMacroQueryComments(BaseMacroQueryComments): class TestMacroArgsQueryComments(BaseMacroArgsQueryComments): @pytest.mark.skip( "This test is incorrectly comparing the version of `dbt-core`" - "to the version of `dbt-postgres`, which is not always the same." + "to the version of `dbt-cratedb2`, which is not the same." ) def test_matches_comment(self, project, get_package_version): pass diff --git a/tests/functional/materializations/materialized_view_tests/test_materialized_view.py b/tests/functional/materializations/materialized_view_tests/test_materialized_view.py index bb63455..3a7e79d 100644 --- a/tests/functional/materializations/materialized_view_tests/test_materialized_view.py +++ b/tests/functional/materializations/materialized_view_tests/test_materialized_view.py @@ -89,14 +89,14 @@ def check_state_alter_change_is_applied(project, materialized_view): @staticmethod def change_config_via_replace(project, materialized_view): - # dbt-postgres does not currently monitor changes of this type + # dbt-cratedb2 does not currently monitor changes of this type pass class TestPostgresMaterializedViewChangesApply( PostgresMaterializedViewChanges, MaterializedViewChangesApplyMixin ): - @pytest.mark.skip("dbt-postgres does not currently monitor replace changes.") + @pytest.mark.skip("dbt-cratedb2 does not currently monitor replace changes.") def test_change_is_applied_via_replace(self, project, my_materialized_view): super().test_change_is_applied_via_replace(project, my_materialized_view) @@ -104,7 +104,7 @@ def test_change_is_applied_via_replace(self, project, my_materialized_view): class TestPostgresMaterializedViewChangesContinue( PostgresMaterializedViewChanges, MaterializedViewChangesContinueMixin ): - @pytest.mark.skip("dbt-postgres does not currently monitor replace changes.") + @pytest.mark.skip("dbt-cratedb2 does not currently monitor replace changes.") def test_change_is_not_applied_via_replace(self, project, my_materialized_view): super().test_change_is_not_applied_via_alter(project, my_materialized_view) @@ -112,6 +112,6 @@ def test_change_is_not_applied_via_replace(self, project, my_materialized_view): class TestPostgresMaterializedViewChangesFail( PostgresMaterializedViewChanges, MaterializedViewChangesFailMixin ): - @pytest.mark.skip("dbt-postgres does not currently monitor replace changes.") + @pytest.mark.skip("dbt-cratedb2 does not currently monitor replace changes.") def test_change_is_not_applied_via_replace(self, project, my_materialized_view): super().test_change_is_not_applied_via_replace(project, my_materialized_view)