Closed FlorianVc closed 5 months ago
Could it be related to SELECT *? Potentially the materialization adds additional columns. Nvarchars are also not supported if you use those. Look into log folder and run the commands listed there manually to see the issues.
The error happens when the temp table is filled. ('SELECT * INTO [database].[schema].[snapshottabel....] FROM [snapshot_table]')
The effected exception block:
On snapshot.dbt_test.test_snapshot: /* {"app": "dbt", "dbt_version": "1.7.11", "profile_name": "dbt_test", "target_name": "dev", "node_id": "snapshot.dbt_test.test_snapshot"} */
SELECT * INTO
[MDH_Process_dbt].[PSA].[test_snapshot_5841]
, CAST(NULL AS varchar(1)) AS
FROM [MDH_Process_dbt].[PSA].[test_snapshot]
fabric adapter: Database error: ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ','. (102) (SQLExecDirectW)")
When I run the same snapshot without the new column Status
, the effected sql block look like this:
SELECT * INTO
[MDH_Process_dbt].[PSA].[test_snapshot_10884]
FROM [MDH_Process_dbt].[PSA].[test_snapshot]
Could it be related to SELECT *? Potentially the materialization adds additional columns.
No, this has no effects, I get the same error and the same sql block is effected.
SELECT * INTO
[MDH_Process_dbt].[PSA].[test_snapshot_6372]
, CAST(NULL AS varchar(1)) AS
FROM [MDH_Process_dbt].[PSA].[test_snapshot]
Ahh well, you might have an old version since I fixed this error:
https://github.com/dbt-msft/dbt-sqlserver/commit/7b5e28c2a96ddd3b640151c92c43fc247adca44e
Can you use main?
Thanks for the fast response. 👍
How can I use the main? Is the fix in the next release?
It seems that is not in the release yet. With pip you can install from the repository, or copy the macro (snapshot.sql) to your local project https://stackoverflow.com/questions/15268953/how-to-install-python-package-from-github
The bug fix works as I expected.
Do you now the release version in which the bug fix is included??
A new one has to be created, I checked the last release (last week) and it did not include the fix.
With the following dbt versions the source changes on the snapshot table work as expected. Core:
Plugins:
When I run
dbt snapshot
for a existing source table that has a new column I get the error:Expectations
The existing snapshot table is extended by the new source table column.
system setup
How to reproduce
dbt run
anddbt snapshot --select test_snapshot
dbt run
anddbt snapshot --select test_snapshot
initial snapshot definition
snapshots\test.sql
Initial Table definition
models\example\test.sql
changed snapshot definition
snapshots\test.sql
changed Table definition
models\example\test.sql