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: Resolve error when cloning Python models (#645) #651

Merged

Conversation

jeancochrane
Copy link
Contributor

Description

Currently, it is not possible to clone Python models using dbt clone because of an outdated reference in the create_or_replace_view macro to a sql context variable that returns None for Python models. This PR represents a one-line change to update that reference to the newer compiled_code context variable that implements the exact same logic as sql but supports Python models as well.

Closes #645.

Models used to test - Optional

Tests have been added to the tests/functional/adapter/test_python_submissions.py file under a new class TestPythonClonePossible. The models defined by this test were used for testing. It didn't seem like unit testing was appropriate in this case, so I focused exclusively on functional testing instead.

Checklist

  • You followed contributing section
  • You kept your Pull Request small and focused on a single feature or bug fix.
  • You added unit testing when necessary
  • You added functional testing when necessary

@jeancochrane jeancochrane force-pushed the jeancochrane/fix-python-model-clone branch from 4e59ebd to a5fdfa2 Compare May 15, 2024 17:18
@jeancochrane
Copy link
Contributor Author

@jessedobbelaere @Jrmyy @mattiamatrix @nicor88 @svdimchenko Anything else you need fro me ahead of review? I'm happy to wait if you're crunched for review time right now, just want to make sure this doesn't fall through the cracks!

@nicor88
Copy link
Member

nicor88 commented May 22, 2024

@Avinash-1394 do you mind to have a look as well?

@nicor88 nicor88 added the enable-functional-tests Label to trigger functional testing label May 22, 2024
Copy link
Member

@nicor88 nicor88 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 fix @jeancochrane

@nicor88 nicor88 merged commit 20f039d into dbt-athena:main May 23, 2024
10 checks passed
@jeancochrane jeancochrane deleted the jeancochrane/fix-python-model-clone branch May 23, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enable-functional-tests Label to trigger functional testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Clone materialization raises an error when cloning Python models
2 participants