Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Back compat for previous return type of collect_freshness #7535

Merged
merged 3 commits into from
May 8, 2023

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented May 6, 2023

resolves #7489

Background:

  • Previously, the built-in collect_freshness macro (used by dbt source freshness) returned just an agate.Table of values.
  • In v1.5, we updated it to return the full query result, including the associated adapter_response (metadata)

Changes in this PR:

  • Check the return type before unpacking in adapter.calculate_freshness
  • Raise a deprecation warning if the calculate_freshness macro returns only an agate.Table

Checklist

@jtcohen6 jtcohen6 changed the title Back compat for previous retrurn type of 'collect_freshness' Back compat for previous return type of collect_freshness May 6, 2023
@jtcohen6 jtcohen6 marked this pull request as ready for review May 6, 2023 17:57
@jtcohen6 jtcohen6 requested a review from a team as a code owner May 6, 2023 17:57
@jtcohen6 jtcohen6 requested a review from a team May 6, 2023 17:57
@jtcohen6 jtcohen6 requested review from a team as code owners May 6, 2023 17:57
Copy link
Member

@aranke aranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, few nits

core/dbt/adapters/base/impl.py Show resolved Hide resolved
core/dbt/task/freshness.py Show resolved Hide resolved
core/dbt/task/freshness.py Show resolved Hide resolved
tests/functional/sources/fixtures.py Outdated Show resolved Hide resolved
Copy link
Member

@aranke aranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jtcohen6 jtcohen6 closed this May 8, 2023
@jtcohen6 jtcohen6 reopened this May 8, 2023
@jtcohen6 jtcohen6 merged commit 35f8ceb into main May 8, 2023
@jtcohen6 jtcohen6 deleted the jerco/7489-collect-freshness-return-back-compat branch May 8, 2023 14:11
@github-actions
Copy link
Contributor

github-actions bot commented May 8, 2023

The backport to 1.5.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.5.latest 1.5.latest
# Navigate to the new working tree
cd .worktrees/backport-1.5.latest
# Create a new branch
git switch --create backport-7535-to-1.5.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 35f8ceb7f1dc575f1fc2e9e573e526f64cf25c9f
# Push it to GitHub
git push --set-upstream origin backport-7535-to-1.5.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.5.latest

Then, create a pull request where the base branch is 1.5.latest and the compare/head branch is backport-7535-to-1.5.latest.

jtcohen6 added a commit that referenced this pull request May 8, 2023
* Back compat for previous retrurn type of 'collect_freshness'

* Test fixups

* PR feedback
jtcohen6 added a commit that referenced this pull request May 8, 2023
…7548)

* Back compat for previous retrurn type of 'collect_freshness'

* Test fixups

* PR feedback
@aranke aranke mentioned this pull request May 9, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-2511] [Regression] source freshness not working in bigquery after upgrade to 1.5
2 participants