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

fix: Add identifier and schema to get_relation_last_modified macro #274

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

xcezz
Copy link

@xcezz xcezz commented Feb 4, 2025

Summary

The get_relation_last_modified macro currently returns an invalid data structure, causing compilation errors when running dbt source freshness.

This PR adds identifier and schema columns and keeps the existing data structure expected by dbt.

Description

After updating dbt and dbt-dremio from 1.7 to 1.8, I noticed that freshness checks no longer work:

20:41:23    Compilation Error in source <SOURCE> (models/sources.yml)
  Got an invalid result from "get_relation_last_modified" macro: [(datetime.datetime(2025, 1, 31, 20, 13, 6), datetime.datetime(2025, 1, 31, 20, 41, 22))]

After reading dbt-labs/dbt-core#8307, especially looking at the get_relation_last_modified reference implementation from Snowflake, I noticed we don't return

  • schema and
  • identifier

With this change, dbt source freshness returns proper freshness information without compilation errors.

Test Results

Changelog

  • Added a summary of what this PR accomplishes to CHANGELOG.md

Related Issue

@howareyouman
Copy link
Contributor

@xcezz Hey!
Thank you for your contribution!
Before merging this PR, please sign Contributor License Agreement, enabling Dremio to distribute your contribution without restriction.
Thank you beforehand!

@wobu
Copy link

wobu commented Feb 4, 2025

some additional context:
in this dbt-adapters PR: dbt-labs/dbt-adapters#127
they introduces the usage and requirement of the 'schema' and 'identifier' field

Copy link
Contributor

@bcmeireles bcmeireles left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!
I see in this PR's CI run that this actually solves one of our known failures in the tests. Could you also please update .github/expected_failures by removing:

tests/functional/adapter/relation/test_get_relation_last_modified.py::TestGetLastRelationModified::test_get_last_relation_modified

Thanks :)

@xcezz xcezz requested a review from bcmeireles February 7, 2025 08:18
@howareyouman
Copy link
Contributor

@xcezz Hey! Have you already signed CLA? Our colleagues haven't received any new CLA signs yet.

@xcezz
Copy link
Author

xcezz commented Feb 12, 2025

@xcezz Hey! Have you already signed CLA? Our colleagues haven't received any new CLA signs yet.

I thought I had already done that. I've just signed it again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants