[英]redshift column encoding with dbt
I am new to using dbt and having trying it out on aws redshift我刚开始使用 dbt 并在 aws redshift 上试用过
Currently I can set the encoding of a column using a create statement outside of dbt
as目前我可以使用
dbt
之外的 create 语句设置列的编码
create table fact_sales (
id integer,
date date NOT NULL encode az64...
)
via dbt I am able to control the data type of the project as通过 dbt 我能够控制项目的数据类型
select
id::integer,
date::date
FROM stg.sales
Is there a way to set the encode az64
via dbt?有没有办法通过 dbt 设置
encode az64
?
I was able to solve this with the following strategy我能够通过以下策略解决这个问题
# model.sql
WITH
/* transform steps */
result as (
/* cast your projections explicitly */
SELECT
id::integer,
date::date
FROM _intermediate_step_table;
),
SELECT * FROM final
post_hooks
querypost_hooks
查询的一部分Reference: https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook
参考: https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook
PROS:优点:
schema.yml
as explained in the discussion in the github issue thread this is the only sane way I could do this, without jumping hoopsschema.yml
直接支持的,如github 问题线程中的讨论中所解释的,这是我可以做到这一点的唯一理智的方式,而无需跳圈CONS:缺点:
ALTERNATE:备用:
In this case在这种情况下
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.