dbt-labs / dbt-labs/dbt

DBT External tables don't work with the `--empty` flag

Open
#10,464 2 comments 0 reactions 0 assignees View on GitHub
awaiting_response empty engine:v1 unit tests
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

I am currently using the lastest version of the [`dbt_external_tables`](https://hub.getdbt.com/dbt-labs/dbt_external_tables) package. The external table builds successfully but does not when I run with the empty flag. I get a sql error with an incorrect bracket. I have the external table and then a view that runs after the external table.

### Expected Behavior

Be able to create external tables with the --empty flag

### Steps To Reproduce

Create an external table
Run the external table with the --empty flag

### Relevant log output

```shell
SQL compilation error:
syntax error line 1 at position 33 unexpected '('.
syntax error line 1 at position 34 unexpected 'select'.
```

Log sql here:

```
create or replace external table (select * from DB_INT.EXTERNAL.e_it_integration_test_json where false limit 0)
location = @DB_INT.landing.ba_olympus_cleaned/integration_test-empty
auto_refresh = True
file_format = DB_DEV.landing.JSON_FORMAT
```

### Environment

```markdown
- OS: Windows
- Python: 3.11
- dbt: 1.8
```

### Which database adapter are you using with dbt?

snowflake

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.