用于dbt(数据构建工具)的presto adpter插件
dbt-presto的Python项目详细描述
DBT火花(docs)
安装
此插件可以通过pip安装:
$ pip install dbt-presto
配置配置文件
可以使用以下配置将dbt配置文件配置为针对presto运行:
Option | Description | Required? | Example |
---|---|---|---|
method | The Presto authentication method to use | Optional(default=^{ | ^{ |
database | Specify the database to build models into | Required | ^{ |
schema | Specify the schema to build models into | Required | ^{ |
host | The hostname to connect to | Required | ^{ |
port | The port to connect to the host on | Required | ^{ |
threads | How many threads dbt should use | Optional(default=^{ | ^{ |
example profiles.yml条目:
my-presto-db:
target: dev
outputs:
dev:
type: presto
method: none
host: 127.0.0.1
port: 8080
database: analytics
schema: dbt_dbanin
threads: 8
使用说明
支持的功能
由于presto的特性,并不是所有的核心dbt功能都受支持。 在presto上没有实现dbt的以下功能:
- 存档
- 增量模型
如果您有兴趣帮助在presto上的dbt中添加对该功能的支持,请open an issue!
所需配置
dbt的基本工作原理是在数据库中删除和创建表和视图。 因此,必须设置以下presto配置,dbt才能在presto上正常工作:
hive.metastore-cache-ttl=0s
hive.metastore-refresh-interval = 5s
hive.allow-drop-table=true
hive.allow-rename-table=true
报告错误和贡献代码
运行测试
在本地运行presto服务器:
cd docker/
./init.bash
如果你在启动presto时看到关于“不一致状态”的错误,
您可能需要在配置单元元存储中删除并重新创建public
架构:
# Example error
Initialization script hive-schema-2.3.0.postgres.sql
Error: ERROR: relation "BUCKETING_COLS" already exists (state=42P07,code=0)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
解决方案:删除(或重命名)公共架构,以允许init脚本从头重新创建元存储。仅对测试预部署运行此命令。不要在生产中运行!
-- run this against the hive metastore (port forwarded to 10005 by default)-- DO NOT RUN THIS IN PRODUCTION!dropschemapubliccascade;createschemapublic;
你可能应该比这稍微少一点鲁莽。
行为准则
在dbt项目的代码库、问题跟踪程序、聊天室和邮件列表中进行交互的每个人都应该遵循PyPA Code of Conduct。