-
Notifications
You must be signed in to change notification settings - Fork 55
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
Bug in macro incremental_delete when using composite keys for unique_key #143
Comments
Perhaps the following implementation for backwards compatibility:
|
@moszutij Your solution is definitely better. |
After examining your solution, I decided to give it a try, but later realised that it only worked for a list of column names enclosed in single quotes, and not for a string representation. However, the documentation suggests that both formats are acceptable, hence the suggested implementation. I haven't had the chance to familiarise myself with the standard dbt-tests-adapter tests yet, but it's on my to-do list 👩💻. I'm also using dbt with mysql, so appreciate the pull requests. |
@moszutij Thanks for checking it out. I really appreciate. There are even more tests in 1.4.latest (shameless plug for my PR #146) when we get there. |
Describe the bug
When using array of columns for
unique_key
in incremental materialization, the macroincremental_delete
chokes and the following error is thrown, using MySQL 8.I'm using code from main branch.
Example of model:
Example of seed:
Exception thrown when running
dbt run
:Steps To Reproduce
Expected behavior
Exception not thrown and rows from seed deleted and then re-inserted without creating duplicates.
The operating system you're using:
Linux GoldenHind 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
The output of
python --version
:Python 3.8.10
MySQL Server 8.0.29
Additional context
The branch
fix-incremental-composite-keys
actually contains the test to ,well, test incremental materialization with composite keys.I couldn't find the equivalent in
dbt-tests-adapter
code...strangely...I must have missed something. I therefore created the classtests/functional/adapter/incremental_composite.py
based on dbt-tests-adapter's very own BaseIncremental class and added a test intests/functional/adapter/test_basic.py
calledTestIncrementalCompositeKeysMySQL
.The problem, I believe, is in 2 parts:
select ( {{ unique_key }} )
to get values for thein ()
.I believe the following would fix the issue:
NB: No *GPT has been harmed, or even used!, during the creation of all this. Just lots of time spent figuring out dbt-tests-adapter and dbt-mysql, git-ing, coding, and typing this very long ticket. Just like old (?) times ;)
The text was updated successfully, but these errors were encountered: