[英]DBT - Syntax error: Expected "(" or keyword SELECT or keyword WITH but got keyword CREATE at
I am trying to make an sql file in dbt in order to update models with a new column我正在尝试在 dbt 中创建一个 sql 文件,以便使用新列更新模型
{{
config(materialized='table'
, retain_previous_version_flg=false
, migrate_data_over_flg=true
)
}}
CREATE OR REPLACE TABLE {{ ref ('my_table') }} (
SELECT *, new_columns_ts TIMESTAMP
);
Is there a way to use CREATE directly rather than having to use SELECT or WITH clause?有没有办法直接使用 CREATE 而不必使用 SELECT 或 WITH 子句?
Syntax error: Expected "(" or keyword SELECT or keyword WITH but got keyword CREATE at [16:1]
In this particular case, you don't need to use the statement CREATE OR REPLACE TABLE, to create a materialized table.在这种特殊情况下,您不需要使用语句 CREATE OR REPLACE TABLE 来创建物化表。 You only need to write the SELECT statement.
只需要写SELECT语句即可。
There are no create or replace statements written in model statements.
model语句中没有写create或replace语句。 This means that dbt does not offer methods for issuing CREATE TABLE statements which can be used for source tables.
这意味着 dbt 不提供发出可用于源表的 CREATE TABLE 语句的方法。
You can see this example .你可以看到这个例子。
{{
config(materialized='table'
, retain_previous_version_flg=false
, migrate_data_over_flg=true
)
}}
SELECT *, new_columns_ts TIMESTAMP from ‘dataset.table’
You can see this option using SQL .您可以使用 SQL 查看此选项。
CREATE OR REPLACE TABLE dataset.table (
SELECT *, new_columns_ts TIMESTAMP from ‘dataset.table’
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.