Skip to content

dbt run --empty throws a syntax error while the model is ran correctly without the --empty flag #412

Closed
@ValBerthe

Description

  • dbt-core version: 1.8.3
  • dbt-duckdb version: 1.8.1

Hello,

dbt run --empty seems to throw a syntax error when dbt run works correctly.

dbt run --select my_model --empty
09:48:08  Running with dbt=1.8.3
09:48:08  Registered adapter: duckdb=1.8.1
09:48:08  Found 6 models, 1 seed, 1 operation, 9 data tests, 1 source, 1 exposure, 411 macros, 1 unit test
09:48:08  
09:48:09  
09:48:09  Running 1 on-run-start hook
09:48:09  1 of 1 START hook: my_project.on-run-start.0 .......................................... [RUN]
09:48:09  1 of 1 OK hook: my_project.on-run-start.0 ............................................. [OK in 0.00s]
09:48:09  
09:48:09  Concurrency: 1 threads (target='dev')
09:48:09  
09:48:09  1 of 1 START sql view model main.my_model ............................ [RUN]
09:48:09  1 of 1 ERROR creating sql view model main.my_model ................... [ERROR in 0.05s]
09:48:09  
09:48:09  Finished running 1 view model, 1 project hook in 0 hours 0 minutes and 0.82 seconds (0.82s).
09:48:09  
09:48:09  Completed with 1 error and 0 warnings:
09:48:09  
09:48:09    Runtime Error in model my_model (models/intermediate/my_model.sql)
  Parser Error: syntax error at or near "t"
09:48:09  
09:48:09  Done. PASS=0 WARN=0 ERROR=1 SKIP=0 TOTAL=1

Without the flag:

dbt run --select my_model
09:47:10  Running with dbt=1.8.3
09:47:10  Registered adapter: duckdb=1.8.1
09:47:10  Found 6 models, 1 seed, 1 operation, 9 data tests, 1 source, 1 exposure, 411 macros, 1 unit test
09:47:10  
09:47:11  
09:47:11  Running 1 on-run-start hook
09:47:11  1 of 1 START hook: my_project.on-run-start.0 .......................................... [RUN]
09:47:11  1 of 1 OK hook: my_project.on-run-start.0 ............................................. [OK in 0.00s]
09:47:11  
09:47:11  Concurrency: 1 threads (target='dev')
09:47:11  
09:47:11  1 of 1 START sql view model main.my_model ............................ [RUN]
09:47:12  1 of 1 OK created sql view model main.my_model ....................... [OK in 0.63s]
09:47:12  
09:47:12  Finished running 1 view model, 1 project hook in 0 hours 0 minutes and 1.43 seconds (1.43s).
09:47:12  
09:47:12  Completed successfully
09:47:12  
09:47:12  Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1

The model :

SELECT
	n.frame as FRAME_ID,
	n.frame_type,
	t.TARGET_MONTH,
	t.DAY,
	t.HOUR,
	0 AS impressions
FROM (
    SELECT DISTINCT
		frame,
		frame_type
		FROM {{ ref('int_raw') }}
) n
CROSS JOIN {{ ref('my_downstream_model') }} t

This prevents me from running unit tests in the CI.

Not sure if the issue is caused by dbt-duckdb's implementation of the --empty flag.

Glad to help resolve this issue!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions