IVR*_*IVR 6 hive apache-spark parquet dbt
我正在尝试设置一个简单的 DBT 管道,该管道使用存储在 Azure Data Lake Storage 上的镶木地板表,并创建另一个也将存储在同一位置的表。
在我的models/(定义为我的源路径)下,我有 2 个文件datalake.yml和orders.sql. datalake.yml看起来像这样:
version:2
sources:
- name: datalake
tables:
- name: customers
external:
location: path/to/storage1 # I got this by from file properties in Azure
file_format: parquet
columns:
- name: id
data_type: int
description: "ID"
- name: ...
Run Code Online (Sandbox Code Playgroud)
我的orders.sql桌子看起来像这样:
{{config(materialized='table', file_format='parquet', location_root='path/to/storage2')}}
select name, age from {{ source('datalake', 'customers') }}
Run Code Online (Sandbox Code Playgroud)
我也在用这个dbt-external-tables包。另请注意,当我运行时dbt debug一切正常,我可以连接到我的数据库(恰好是 Databricks)。
我尝试运行dbt run-operation stage_external_sources它返回Error: staging external sources is not implemented for the default adapter. 当我跑步时dbt run,我得到了Error: UnresolvedRelation datalake.customers。
或者也许我可以以某种方式使用 hive 元存储?任何有关如何解决此问题的提示将不胜感激!
我帮助维护插件dbt-spark和dbt-external-tables包。我可以确认它们的互操作性仍处于初步阶段,我强烈欢迎为改进它做出贡献。我不认为这是一个很大的提升,尽管挑战之一是 Spark/Databricks 支持两种不同的create external table语法(如该问题中所述)。
FWIW 我看到您指定了path/to/storage源的外部位置和location_root模型的配置orders。前者是从中读取数据的地方,后者是将模型具体化为表的地方。我不确定你的意思是代表相同的占位符还是不同的占位符。
编辑: TIL,您可以直接在 SparkSQL 中从某些文件类型中选择select * from filetype.filepath. 我相信您可以注册一个来源,例如:
version:2
sources:
- name: datalake
schema: parquet
tables:
- name: customers
identifier: "path/to/storage1"
quoting:
identifier: true
Run Code Online (Sandbox Code Playgroud)
这意味着您可以拥有如下模板化代码:
select * from {{ source('datalake', 'customers') }}
Run Code Online (Sandbox Code Playgroud)
这将解决:
select * from parquet.`path/to/storage1`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6792 次 |
| 最近记录: |