You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating views using dbt (dbt run) for a BigQuery project, the views are successfully created but with an extra set of parentheses and extra spacing.
I believe this is due to the bigquery__create_view_as macro which uses the following to create the view
create or replace view {{ relation }}
{{ bigquery_table_options(config, model, temporary=false) }}
as (
{{ sql }}
);
Based on the BigQuery docs, views should be created like this
{CREATE VIEW | CREATE VIEW IF NOT EXISTS | CREATE OR REPLACE VIEW}
view_name
[OPTIONS(view_option_list)]
AS query_expression
The difference being no parentheses or extra spacing after the AS.
Steps To Reproduce
Create the following SQL file, names test.sql, in your models folder
SELECT 1 as column1
Run dbt run to create the view in your BigQuery project and observe that the created view in BigQuery has the following SQL:
(
SELECT 1 as column1
)
Expected behavior
The expected SQL for the view in BigQuery should be:
SELECT 1 as column1
Screenshots and log output
N/A
System information
postgres
redshift
bigquery
snowflake
other (specify: ____________)
The output of dbt --version:
installed version: 0.16.1
latest version: 0.16.1
Up to date!
The operating system you're using:
macOS Catalina (10.15.4)
The output of python --version:
Python 3.8.1
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Thanks for the issue and PR, @azhard. This change seems fine to me. I just want to confirm that this is for purely cosmetic reasons? I know that BQ displays view definitions to console users.
Describe the bug
When creating views using dbt (
dbt run
) for a BigQuery project, the views are successfully created but with an extra set of parentheses and extra spacing.I believe this is due to the
bigquery__create_view_as
macro which uses the following to create the viewBased on the BigQuery docs, views should be created like this
The difference being no parentheses or extra spacing after the
AS
.Steps To Reproduce
Create the following SQL file, names test.sql, in your
models
folderRun
dbt run
to create the view in your BigQuery project and observe that the created view in BigQuery has the following SQL:Expected behavior
The expected SQL for the view in BigQuery should be:
Screenshots and log output
N/A
System information
The output of
dbt --version
:The operating system you're using:
macOS Catalina (10.15.4)
The output of
python --version
:Additional context
N/A
The text was updated successfully, but these errors were encountered: