name: extract-bq-schema description: 直接提取BigQuery数据集中的架构
提取BigQuery架构技能
直接提取BigQuery数据集中的表架构到Starlake YAML配置文件中。与使用JDBC的extract-schema不同,此命令直接使用BigQuery API以更好地提取元数据。
用法
starlake extract-bq-schema [options]
选项
--connection <值>: 来自application.sl.yml的BigQuery连接引用--database <值>: GCP项目ID--tables <值>: 要提取的dataset.table对的逗号分隔列表--external: 包括在_config.sl.yml中定义的外部数据集--write <值>: 输出写入模式:OVERWRITE,APPEND--accessToken <值>: 用于GCP身份验证的访问令牌--persist <值>: 将结果持久化到文件(true/false)--reportFormat <值>: 报告输出格式:console,json, 或html
配置上下文
需要在application.sl.yml中配置BigQuery连接:
# metadata/application.sl.yml
version: 1
application:
connections:
bigquery:
type: "bigquery"
options:
location: "europe-west1"
authType: "APPLICATION_DEFAULT"
authScopes: "https://www.googleapis.com/auth/cloud-platform"
writeMethod: "direct"
示例
从项目中提取所有架构
starlake extract-bq-schema --database my-gcp-project
提取特定表
starlake extract-bq-schema --database my-gcp-project --tables sales.orders,sales.customers
提取并持久化
starlake extract-bq-schema --database my-gcp-project --persist true
提取包括外部数据集
starlake extract-bq-schema --database my-gcp-project --external
相关技能
- extract-schema - 通过JDBC提取架构
- bq-info - 获取BigQuery表信息
- extract - 提取架构和数据