StarRocks / dbt-starrocks

dbt-starrocks contains all of the code enabling dbt to work with StarRocks
16 stars 6 forks source link

Database Error in snapshot ts_snapshot #29

Open alberttwong opened 6 months ago

alberttwong commented 6 months ago
Invoking dbt with ['snapshot', '--vars', 'seed_name: added']
21:41:14  Running with dbt=1.6.2
21:41:14  Registered adapter: starrocks=1.4.2
21:41:14  Unable to do partial parsing because config vars, config profile, or config target have changed
21:41:14  Found 1 snapshot, 3 seeds, 0 sources, 0 exposures, 0 metrics, 335 macros, 0 groups, 0 semantic models
21:41:14  
21:41:14  Concurrency: 1 threads (target='default')
21:41:14  
21:41:14  1 of 1 START snapshot test17102796730728107077_test_basic.ts_snapshot .......... [RUN]
21:41:15  1 of 1 ERROR snapshotting test17102796730728107077_test_basic.ts_snapshot ...... [ERROR in 0.31s]
21:41:15  
21:41:15  Finished running 1 snapshot in 0 hours 0 minutes and 0.37 seconds (0.37s).
21:41:15  
21:41:15  Completed with 1 error and 0 warnings:
21:41:15  
21:41:15    Database Error in snapshot ts_snapshot (snapshots/ts_snapshot.sql)
  1064 (HY000): Getting syntax error at line 3, column 68. Detail message: Unexpected input ',', the most similar input is {'SET'}.
  compiled Code at target/run/snapshot_strategy_timestamp/snapshots/ts_snapshot.sql
21:41:15  
21:41:15  Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1
alberttwong commented 6 months ago
          update `test17102808078784722010_test_basic`.`ts_snapshot`, (select dbt_scd_id, dbt_change_type, dbt_valid_to from `test17102808078784722010_test_basic`.`ts_snapshot__dbt_tmp`) as DBT_INTERNAL_SOURCE
    set `test17102808078784722010_test_basic`.`ts_snapshot`.dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to
    where DBT_INTERNAL_SOURCE.dbt_scd_id = `test17102808078784722010_test_basic`.`ts_snapshot`.dbt_scd_id
    and DBT_INTERNAL_SOURCE.dbt_change_type = 'update'
    and `test17102808078784722010_test_basic`.`ts_snapshot`.dbt_valid_to is null

22:00:13  starrocks adapter: StarRocks error: 1064 (HY000): Getting syntax error at line 3, column 68. Detail message: Unexpected input ',', the most similar input is {'SET'}.
alberttwong commented 6 months ago

I don't know how to rewrite this macro

{% macro starrocks__snapshot_merge_sql_update(target, source, insert_cols) -%}
    update {{ target }}, (select dbt_scd_id, dbt_change_type, dbt_valid_to from {{ source }}) as DBT_INTERNAL_SOURCE
    set {{ target }}.dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to
    where DBT_INTERNAL_SOURCE.dbt_scd_id = {{ target }}.dbt_scd_id
    and DBT_INTERNAL_SOURCE.dbt_change_type = 'update'
    and {{ target }}.dbt_valid_to is null
{% endmacro %}