Skip to content

Commit

Permalink
Merge pull request #404 from dbt-labs/monorepo/migrate-dbt-spark
Browse files Browse the repository at this point in the history
ADAP-1132: Migrate dbt-spark into dbt-adapters
  • Loading branch information
mikealfare authored Jan 13, 2025
2 parents b8c7938 + 39cabd9 commit 5983011
Show file tree
Hide file tree
Showing 120 changed files with 9,050 additions and 9 deletions.
39 changes: 31 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,35 @@
resolves #<issue-number>
resolves #
[docs](https://github.com/dbt-labs/docs.getdbt.com/issues/new/choose) dbt-labs/docs.getdbt.com/#

# Description
<!---
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.
<!-- What approach was taken to resolve the issue and why? -->
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.
-->

## Checklist
### Problem

- [ ] This PR considers the [contributing guide](https://github.com/dbt-labs/dbt-adapters#contributing)
- [ ] This PR is small and focused on a single feature or bug fix
- [ ] This PR includes unit testing, or unit testing is not necessary
- [ ] This PR includes functional testing, or functional testing is not necessary
<!---
Describe the problem this PR is solving. What is the application state
before this PR is merged?
-->

### Solution

<!---
Describe the way this PR solves the above problem. Add as much detail as you
can to help reviewers understand your changes. Include any alternatives and
tradeoffs you considered.
-->

### Checklist

- [ ] I have read [the contributing guide](https://github.com/dbt-labs/dbt-core/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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ updates:
- "/dbt-tests-adapter"
- "/dbt-athena"
- "/dbt-athena-community"
- "/dbt-spark"
schedule:
interval: "daily"
rebase-strategy: "disabled"
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
- package-ecosystem: "docker"
directory: "dbt-spark/docker"
schedule:
interval: "weekly"
rebase-strategy: "disabled"
ignore:
- dependency-name: "*"
update-types:
- version-update:semver-patch
- package-ecosystem: "github-actions"
directory: "/"
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 @@ -35,6 +35,7 @@ on:
- "dbt-adapters"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
merge:
description: "Choose whether to merge the changelog branch"
type: boolean
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ on:
options:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
branch:
description: "Choose the branch to test"
type: string
Expand All @@ -52,6 +53,17 @@ permissions:
id-token: write
contents: read

env:
DBT_INVOCATION_ENV: ${{ vars.DBT_INVOCATION_ENV }}
DD_CIVISIBILITY_AGENTLESS_ENABLED: ${{ vars.DD_CIVISIBILITY_AGENTLESS_ENABLED }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_SITE: ${{ vars.DD_SITE }}
DD_ENV: ${{ vars.DD_ENV }}
DD_SERVICE: ${{ github.event.repository.name }} # this can change per run because of forks
DBT_TEST_USER_1: ${{ vars.DBT_TEST_USER_1 }}
DBT_TEST_USER_2: ${{ vars.DBT_TEST_USER_2 }}
DBT_TEST_USER_3: ${{ vars.DBT_TEST_USER_3 }}

jobs:
integration-tests-athena:
if: ${{ inputs.package == 'dbt-athena' || inputs.package == 'dbt-athena-community' }}
Expand Down Expand Up @@ -83,3 +95,38 @@ jobs:
aws-region: ${{ vars.DBT_TEST_ATHENA_REGION_NAME }}
- run: hatch run integration-tests
working-directory: ./${{ inputs.package }}

integration-tests-spark:
if: ${{ inputs.package == 'dbt-spark' }}
runs-on: ${{ inputs.os }}
environment:
name: "dbt-spark"
env:
DBT_DATABRICKS_CLUSTER_NAME: ${{ secrets.DBT_DATABRICKS_CLUSTER_NAME }}
DBT_DATABRICKS_HOST_NAME: ${{ secrets.DBT_DATABRICKS_HOST_NAME }}
DBT_DATABRICKS_ENDPOINT: ${{ secrets.DBT_DATABRICKS_ENDPOINT }}
DBT_DATABRICKS_TOKEN: ${{ secrets.DBT_DATABRICKS_TOKEN }}
DBT_DATABRICKS_USER: ${{ secrets.DBT_DATABRICKS_USER }}
strategy:
fail-fast: false
matrix:
profile:
- "apache_spark"
- "spark_session"
- "spark_http_odbc"
- "databricks_sql_endpoint"
- "databricks_cluster"
- "databricks_http_cluster"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- uses: pypa/hatch@install
- run: hatch run pip install -r dagger/requirements.txt
working-directory: ./${{ inputs.package }}
- run: hatch run integration-tests --profile ${{ matrix.profile }}
working-directory: ./${{ inputs.package }}
1 change: 1 addition & 0 deletions .github/workflows/_publish-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
options:
- "dbt-adapters"
- "dbt-athena"
- "dbt-spark"
deploy-to:
description: "Choose whether to publish to test or prod"
type: environment
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 @@ -24,6 +24,7 @@ on:
- "dbt-adapters"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
deploy-to:
description: "Choose whether to publish to test or prod"
type: environment
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 @@ -32,6 +32,7 @@ on:
- "dbt-adapters"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
branch:
description: "Choose the branch to test"
type: string
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 @@ -33,6 +33,7 @@ on:
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
branch:
description: "Choose the branch to build"
type: string
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
deploy-to:
description: "Choose whether to publish to test or prod"
type: environment
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 @@ -34,6 +34,7 @@ jobs:
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
Expand All @@ -52,6 +53,7 @@ jobs:
- "dbt-adapters"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
os: [ ubuntu-22.04 ]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
Expand All @@ -69,6 +71,7 @@ jobs:
package:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-spark"
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
Expand Down
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ dmypy.json
# pytype static type analyzer
.pytype/

# Pyenv
.python-version

# Cython debug symbols
cython_debug/

Expand All @@ -164,3 +167,10 @@ cython_debug/

# Vim
*.swp

# other
.hive-metastore/
.spark-warehouse/
dbt-integration-tests
/.tool-versions
/.hypothesis/*
5 changes: 4 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ repos:
- --target-version=py311
- --target-version=py312
- --force-exclude=dbt/adapters/events/adapter_types_pb2.py
additional_dependencies: [flaky]

- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
exclude: dbt/adapters/events/adapter_types_pb2.py|tests/functional/
exclude: dbt/adapters/events/adapter_types_pb2.py|tests/functional/|dbt-spark/tests/
args:
- --max-line-length=99
- --select=E,F,W
Expand All @@ -54,4 +55,6 @@ repos:
additional_dependencies:
- types-PyYAML
- types-protobuf
- types-python-dateutil
- types-pytz
- types-requests
12 changes: 12 additions & 0 deletions dbt-spark/.changes/0.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Previous Releases
For information on prior major and minor releases, see their changelogs:
- [1.6](https://github.com/dbt-labs/dbt-spark/blob/1.6.latest/CHANGELOG.md)
- [1.5](https://github.com/dbt-labs/dbt-spark/blob/1.5.latest/CHANGELOG.md)
- [1.4](https://github.com/dbt-labs/dbt-spark/blob/1.4.latest/CHANGELOG.md)
- [1.3](https://github.com/dbt-labs/dbt-spark/blob/1.3.latest/CHANGELOG.md)
- [1.2](https://github.com/dbt-labs/dbt-spark/blob/1.2.latest/CHANGELOG.md)
- [1.1](https://github.com/dbt-labs/dbt-spark/blob/1.1.latest/CHANGELOG.md)
- [1.0](https://github.com/dbt-labs/dbt-spark/blob/1.0.latest/CHANGELOG.md)
- [0.21](https://github.com/dbt-labs/dbt-spark/blob/0.21.latest/CHANGELOG.md)
- [0.20](https://github.com/dbt-labs/dbt-spark/blob/0.20.latest/CHANGELOG.md)
- [0.19 and earlier](https://github.com/dbt-labs/dbt-spark/blob/0.19.latest/CHANGELOG.md)
3 changes: 3 additions & 0 deletions dbt-spark/.changes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CHANGELOG

To view information about the changelog operation we suggest reading this [README](https://github.com/dbt-labs/dbt-spark/blob/main/.changes/README.md) found in `dbt-spark`.
6 changes: 6 additions & 0 deletions dbt-spark/.changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# dbt-spark Changelog

- This file provides a full account of all changes to `dbt-spark`.
- Changes are listed under the (pre)release in which they first appear. Subsequent releases include changes from previous releases.
- "Breaking changes" listed under a version may require action from end users or external maintainers when upgrading to that version.
- Do not edit this file directly. This file is auto-generated using [changie](https://github.com/miniscruff/changie). For details on how to document a change, see [the contributing guide](https://github.com/dbt-labs/dbt-spark/blob/main/CONTRIBUTING.md#adding-changelog-entry)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Under the Hood
body: Move from setup.py to pyproject.toml and to hatch as a dev tool
time: 2024-12-07T18:18:14.85697-05:00
custom:
Author: mikealfare
Issue: "1150"
Loading

0 comments on commit 5983011

Please sign in to comment.