-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Incremental snapshot sql fails on postgres 9.6 on dbt >= 0.17.0 #3064
Comments
@DavidAkroyd Thanks for the detailed bug report. I'm in favor of continuing support for Postgres 9.6, so long the way to do it is straightforward enough. Is this just a matter of updating lines 83, 101, and 118? 'insert'::text as dbt_change_type,
...
'update'::text as dbt_change_type,
...
'delete'::text as dbt_change_type, This is just slightly trickier than #1666, because unlike {% macro string_literal(string) -%}
{{ return(adapter.dispatch('string_literal')(string)) }}
{%- endmacro %}
{% macro default__string_literal(string) %}
{% set literal -%} '{{ string }}' {%- endset %}
{{ return(literal)}}
{% endmacro %}
{% macro postgres__string_literal(string) %}
{% set literal -%} '{{ string }}'::text {%- endset %}
{{ return(literal)}}
{% endmacro %} And then the lines in {{ string_literal('insert') }} as dbt_change_type,
...
{{ string_literal('update') }} as dbt_change_type,
...
{{ string_literal('delete') }} as dbt_change_type, Is that a fix you'd be interested in contributing? |
@jtcohen6 Thanks! Yes, as far as I can tell, it simply just requires the updating of these three lines which are causing the issue. I need to confirm if I can find time to set up the environment/sign contributors form etc, and then I should hopefully be able to a) test that this approach fixes the issue and b) contribute it in a PR Thanks for your help! |
Hello, I'm in a similar possition, needing to overwrite a macro that is not dispatched on order to make snapshots available for oracle database. Specifically this macro: Should I open another issue for that? I'm asking here because a I could implement changes for both macros. Thankyou! |
Hi @vitoravancini! Is the presence of
If it turns out that there are other things you'd need to change about the default materialization, then you'll already need to define
Where |
I'll change the dbt code in my python env here to see if I need to change anything else. Any of other database plugins change the default snapshot implementation? If I do have to change it will I have to re implement the whole materialization? |
Just saw the dbt-spark do change the snapshot implementation, I can use it as an example if I have to go down that path. Thanks for the instructions @jtcohen6 |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue, or it will be closed in 7 days. |
Describe the bug
Incremental snapshots do not work on Postgres 9.6
Steps To Reproduce
Create a snapshot using DBT when using a Postgres 9.6 database, and then attempt an incremental snapshot (i.e. run dbt snapshot twice)
Error received of
This is a regression of #1665
Another user has identified on the slack that this was caused by #2390 due to the union using non-casted fields introducing the issue in dbt 0.17.0
Expected behavior
DBT incremental snapshots should not throw an error on Postgres 9.6
System information
Which database are you using dbt with?
The output of
dbt --version
:Additional context
Whilst I appreciate that this is for a unsupported "legacy" version of Postgres, I hope to be able to personally contribute to introduce to the Postgres plugin the equivalent fix as was introduced in #1665 which should extend the life/support of dbt on 9.6 until it's designated EoL of Nov 2021
The text was updated successfully, but these errors were encountered: