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

[Bug] Snapshots and incremental models cannot add array columns #157

Open
2 tasks done
tweavers opened this issue Oct 14, 2024 · 1 comment
Open
2 tasks done

[Bug] Snapshots and incremental models cannot add array columns #157

tweavers opened this issue Oct 14, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@tweavers
Copy link

Is this a new bug?

  • I believe this is a new bug
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Adding an array-type column to an existing snapshot or incremental model will result in the following syntax error.

alter table "postgres"."dbt_teddy_snapshots"."test_model_snapshot" add column "some_array" ARRAY;
Postgres adapter: Postgres error: syntax error at or near "ARRAY"

Example

# example_model.sql (before)
select
  1::numeric as col_a,
  2::int as col_b,
  'some_text' as col_c

# example_model.sql (after)
select
  1::numeric as col_a,
  2::int as col_b,
  'some_text' as col_c
  null::text[] as some_array

Expected Behavior

Alter table command should look like something like the following:
alter table "postgres"."dbt_snapshots"."example_model_snapshot" add column "some_array" text[];

Steps To Reproduce

  1. Build above example_model with a downstream snapshot and incremental model
  2. Add an array column to example_model
  3. Build example_model and the downstream incremental models and snapshots

Relevant log output

14:41:28.002733 [debug] [Thread-1 (]: SQL status: SELECT 8 in 0.003 seconds
14:41:28.005418 [debug] [Thread-1 (]: Using postgres connection "snapshot.thymecare.test_model_snapshot"
14:41:28.005658 [debug] [Thread-1 (]: On snapshot.thymecare.test_model_snapshot: /* {"app": "dbt", "dbt_version": "1.8.6", "profile_name": "postgres", "target_name": "local", "node_id": "snapshot.thymecare.test_model_snapshot"} */

      alter table "postgres"."dbt_snapshots"."test_model_snapshot" add column "some_array" ARRAY;
    
14:41:28.009511 [debug] [Thread-1 (]: Postgres adapter: Postgres error: syntax error at or near "ARRAY"
LINE 3: ...pshots"."test_model_snapshot" add column "some_array" ARRAY;

Environment

- OS: Sequoia 15.0.1
- Python: 3.11.4
- dbt-postgres: 1.8.2

Additional Context

No response

@tweavers tweavers added bug Something isn't working triage labels Oct 14, 2024
@tweavers
Copy link
Author

bump on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant