【问题标题】:How can I debug the dbt error that says "Database error while listing schemas in database XYZ"?如何调试显示“在数据库 XYZ 中列出模式时出现数据库错误”的 dbt 错误?
【发布时间】:2021-12-05 03:35:01
【问题描述】:

感谢您对此提供的任何帮助/想法。

我正在使用 Snowflake 和 dbt CLI,Fivetran 作为编排器

我在 profile.yml 中添加了一个名为 dev 的配置文件,并输入了所有连接详细信息

profiles.yml 现在看起来像这样

default:
  target: prod
  outputs:
    prod:
      type: snowflake
      account: XYZ
      user: XYZ
      role: XYZ
      authenticator: XYZ
      database: ANALYTICS
      warehouse: XYZ
      schema: REPORTING
    dev:
      type: snowflake
      account: XYZ
      user: XYZ
      role: XYZ
      authenticator: XYZ
      database: ANALYTICS
      warehouse: XYZ
      schema: DEV_THEDRE

当我运行命令 dbt run target prod -m model_name 时没有问题(我的模型被具体化到名为 Reporting 的架构中。

但是,当我运行命令 dbt run target dev -m model_name 时,我收到一条错误消息: DEncountered an error: Runtime Error Database error while listing schemas in database "DEV" Database Error 002043 (02000): SQL compilation error: Object does not exist, or operation cannot be performed.

但是,我的雪花实例中没有名为 dev 的数据库。我不明白为什么它试图找到这个名为“DEV”的数据库。

我将配置文件的名称更改为 sand 以查看是否会将错误消息中的单词 dev 替换为单词 sand,但错误消息仍然显示“DEV”

dbt 日志文件显示如下:

2021-10-17 20:37:54.100339 (ThreadPoolExecutor-0_0): Acquiring new snowflake connection "list_DEV".
2021-10-17 20:37:54.113467 (ThreadPoolExecutor-0_0): Using snowflake connection "list_DEV".
2021-10-17 20:37:54.113577 (ThreadPoolExecutor-0_0): On list_DEV: /* {"app": "dbt", "dbt_version": "0.20.2", "profile_name": "default", "target_name": "dev", "connection_name": "list_DEV"} */

    show terse schemas in database DEV
    limit 10000
2021-10-17 20:37:54.113669 (ThreadPoolExecutor-0_0): Opening a new connection, currently in state init
2021-10-17 20:37:54.130004 (ThreadPoolExecutor-0_0): Loading KWallet
2021-10-17 20:37:54.131793 (ThreadPoolExecutor-0_0): Loading SecretService
2021-10-17 20:37:54.133543 (ThreadPoolExecutor-0_0): Loading Windows
2021-10-17 20:37:54.135003 (ThreadPoolExecutor-0_0): Loading chainer
2021-10-17 20:37:54.135968 (ThreadPoolExecutor-0_0): Loading macOS
2021-10-17 20:38:11.616136 (ThreadPoolExecutor-0_0): Snowflake query id: 019facf6-0601-3ffb-0038-1583017946a2
2021-10-17 20:38:11.617116 (ThreadPoolExecutor-0_0): Snowflake error: 002043 (02000): SQL compilation error:
Object does not exist, or operation cannot be performed.
2021-10-17 20:38:11.617625 (ThreadPoolExecutor-0_0): Error running SQL: macro list_schemas
2021-10-17 20:38:11.617828 (ThreadPoolExecutor-0_0): Rolling back transaction.
2021-10-17 20:38:11.618305 (ThreadPoolExecutor-0_0): On list_DEV: Close
2021-10-17 20:38:11.918642 (MainThread): Connection 'master' was properly closed.
2021-10-17 20:38:11.918799 (MainThread): Connection 'list_DEV' was properly closed.
2021-10-17 20:38:11.919141 (MainThread): Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x104d84400>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x104c9db50>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x104ca10d0>]}
2021-10-17 20:38:11.919411 (MainThread): Flushing usage events
2021-10-17 20:38:12.176058 (MainThread): Encountered an error:
2021-10-17 20:38:12.176328 (MainThread): Runtime Error
  Database error while listing schemas in database "DEV"
  Database Error
    002043 (02000): SQL compilation error:
    Object does not exist, or operation cannot be performed.```

Thank you once again!

【问题讨论】:

    标签: snowflake-cloud-data-platform dbt fishtown-analytics


    【解决方案1】:

    我发现了问题 有一个宏说 如果目标 = Prod,则数据库 = 默认名称 ELSE 数据库 = dev 我改变了它,它现在可以工作了

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 1970-01-01
    • 2020-04-23
    • 2021-03-29
    • 2020-06-14
    • 1970-01-01
    • 2017-02-07
    • 1970-01-01
    • 2013-04-17
    • 1970-01-01
    相关资源
    最近更新 更多