Skip to content

Commit

Permalink
Merge branch 'main' into monorepo/migrate-branch-script
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Jan 30, 2025
2 parents 0b78921 + a5e3e1e commit b15ea69
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/_integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ jobs:

integration-tests-bigquery-flaky:
# we only run this for one python version to avoid running in parallel
if: ${{ inputs.package == 'dbt-bigquery' && inputs.python-version == '3.9' }}
if: ${{ inputs.package == 'dbt-bigquery' && inputs.python-version == vars.DEFAULT_PYTHON_VERSION }}
runs-on: ${{ inputs.os }}
environment:
name: "dbt-bigquery"
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:

integration-tests-redshift-flaky:
# we only run this for one python version to avoid running in parallel
if: ${{ inputs.package == 'dbt-redshift' && inputs.python-version == '3.9' }}
if: ${{ inputs.package == 'dbt-redshift' && inputs.python-version == vars.DEFAULT_PYTHON_VERSION }}
runs-on: ${{ inputs.os }}
environment:
name: "dbt-redshift"
Expand Down
24 changes: 8 additions & 16 deletions .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "Pull request checks"
run-name: "Publish - #${{ github.event.number }} - ${{ github.actor }}"
run-name: "Pull request checks - #${{ github.event.number }} - ${{ github.actor }}"

on:
pull_request_target:
Expand Down Expand Up @@ -52,10 +52,8 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.affected-packages.outputs.changelog-entry-check) }}
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
package: "dbt-athena"
package: ${{ matrix.package }}
pull-request: ${{ github.event.pull_request.number }}
secrets: inherit

Expand All @@ -73,14 +71,12 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.affected-packages.outputs.verify-build) }}
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}

unit-tests:
uses: ./.github/workflows/_unit-tests.yml
Expand All @@ -90,14 +86,12 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.affected-packages.outputs.unit-tests) }}
os: [ ubuntu-22.04 ]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}

integration-tests:
uses: ./.github/workflows/_integration-tests.yml
Expand All @@ -107,14 +101,12 @@ jobs:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.affected-packages.outputs.integration-tests) }}
os: [ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11", "3.12"]
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
secrets: inherit

# This job does nothing and is only used for branch protection
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/scheduled-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: "Scheduled tests"

on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:

jobs:
verify-builds:
uses: ./.github/workflows/_verify-build.yml
strategy:
fail-fast: false
matrix:
package:
- "dbt-adapters"
- "dbt-tests-adapter"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-snowflake"
- "dbt-spark"
os: [ubuntu-22.04, macos-14, windows-2022]
python-version: ${{ fromJson(vars.SUPPORTED_PYTHON_VERSIONS) }}
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

unit-tests:
uses: ./.github/workflows/_unit-tests.yml
strategy:
fail-fast: false
matrix:
package:
- "dbt-adapters"
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-snowflake"
- "dbt-spark"
os: [ubuntu-22.04, macos-14, windows-2022]
python-version: ${{ fromJson(vars.SUPPORTED_PYTHON_VERSIONS) }}
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

integration-tests:
uses: ./.github/workflows/_integration-tests.yml
strategy:
fail-fast: false
matrix:
package:
- "dbt-athena"
- "dbt-athena-community"
- "dbt-bigquery"
- "dbt-postgres"
- "dbt-redshift"
- "dbt-snowflake"
- "dbt-spark"
with:
package: ${{ matrix.package }}
branch: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: ${{ vars.DEFAULT_RUNNER }}
python-version: ${{ vars.DEFAULT_PYTHON_VERSION }}
secrets: inherit

notification:
if: always()
needs: [verify-builds, unit-tests, integration-tests]
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
# This step is needed to aggregate the results of the other jobs and apply it to this job for the Slack notification
- id: results
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
- uses: ravsamhq/notify-slack-action@v2
if: ${{ always() }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
notification_title: "{workflow} has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "View run: {workflow_url}"
mention_users: "S066LNHS2N6"
mention_users_when: "failure,warnings"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DEV_ADAPTER_ALERTS }}
11 changes: 11 additions & 0 deletions dbt-athena/src/dbt/adapters/athena/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,3 +1452,14 @@ def _run_query(self, sql: str, catch_partitions_limit: bool) -> AthenaCursor:
LOGGER.debug(f"CAUGHT EXCEPTION: {e}")
raise e
return cursor

@classmethod
def _get_adapter_specific_run_info(cls, config: RelationConfig) -> Dict[str, Any]:
try:
table_format = config._extra.get("table_type")
except AttributeError:
table_format = None
return {
"adapter_type": "athena",
"table_format": table_format,
}
3 changes: 3 additions & 0 deletions dbt-athena/tests/functional/adapter/test_retries_iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
seeds__expected_target_post = "id,status\n" + "\n".join([f"{i},{i}" for i in range(PARALLELISM)])


@pytest.mark.skip(
reason="Unreliable test in practice. No apparent reliable way to trigger a retry, which causes the test to fail. Disabled until we get a resolution here https://github.com/dbt-labs/dbt-athena/pull/657/files#r1922043351"
)
class TestIcebergRetriesDisabled:
@pytest.fixture(scope="class")
def dbt_profile_target(self):
Expand Down
28 changes: 28 additions & 0 deletions dbt-athena/tests/unit/test_adapter_telemetry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from unittest import mock

import dbt.adapters.athena.__version__

from dbt.adapters.athena.impl import AthenaAdapter
from dbt.adapters.base.relation import AdapterTrackingRelationInfo


def test_telemetry_with_athena_details():
mock_model_config = mock.MagicMock()
mock_model_config._extra = mock.MagicMock()
mock_model_config._extra = {
"adapter_type": "athena",
"table_type": "iceberg",
}

res = AthenaAdapter.get_adapter_run_info(mock_model_config)

assert res.adapter_name == "athena"
assert res.base_adapter_version == dbt.adapters.__about__.version
assert res.adapter_version == dbt.adapters.athena.__version__.version

assert res.model_adapter_details == {
"adapter_type": "athena",
"table_format": "iceberg",
}

assert isinstance(res, AdapterTrackingRelationInfo)

0 comments on commit b15ea69

Please sign in to comment.