AWS Wrangler 错误 HIVE_METASTORE_ERROR:表缺少存储描述符

发布于 2025-01-16 23:05:29 字数 836 浏览 1 评论 0原文

希望您能帮助我解决 awswrangler 的错误问题。

情况是这样的:我有 2 个 aws 账户,AccountAAccountB,都启用了 Lakeformation,我在 AccA 中有一组数据库,在 AccB 中有另一组数据库,所以我们通过 Lakeformation 将 AccountB 数据库共享给 AccountA,以便我们可以在 AccountA 中使用 Athena 查询他们的数据库/表。

我正在尝试使用 python 自动执行 sql 查询,因此我使用 awswrangler 来实现此目的,但是在 python 中运行查询时,我遇到了一个不太具体的错误。

当我运行“select * from DatabaseAccB.Table”时出现此错误“HIVE_METASTORE_ERROR:表缺少存储描述符”可能是什么原因?我尝试使用 boto3.Athena 会话并得到相同的结果。

这可能会有所帮助,当我与我的用户一起查询 select * from DatabaseAccB.Table 时,这运行良好。但是当我尝试使用 lambda 或胶水作业执行此操作时,失败并出现前面提到的错误。

PD:AccountA 对 AccountB 中的表仅具有选择/描述权限。如果需要,可以显示一些代码。

PD2:如果运行“select * from DatabaseAccA.Table”查询运行良好,

尝试使用 Boto 3,结果相同。

尝试使用 lambda,结果相同。

尝试授予管理员访问 AccountA 中的粘合角色的权限,结果相同。

我认为 Lakeformation 正在发生一些事情。

谢谢!

hope you can help me with a concern about an error with awswrangler.

this is the case: i have 2 aws accounts, AccountA and AccountB, both with lakeformation enabled, i have a set of databases in AccA and another set in AccB, so we share AccountB databases to AccountA through lakeformation so we can query their Db/tables with Athena in AccountA.

i am trying to automate a sql query with python, so i'm using awswrangler to achieve this, but i'm getting a not very specific error when in run the query in python.

when i run "select * from DatabaseAccB.Table" get this error "HIVE_METASTORE_ERROR: Table is missing storage descriptor" what could be the cause? i tried with boto3.Athena session and same result.

this may should help, when i query select * from DatabaseAccB.Table with my user, this runs fine. but when i try to do it with lambda or glue job, fails with error mentioned before.

PD: AccountA has only select/describe permission on tables in AccountB. Can show some code if you need.

PD2: if run "select * from DatabaseAccA.Table" query runs fine

tried with Boto 3, same result.

Tried using lambda, same result.

Tried giving admin access to glue role in AccountA, same result.

I think that there something happening with Lakeformation.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我家小可爱 2025-01-23 23:05:29

确保您的 Lambda/Glue 作业执行角色具有以下 Lake Formation 权限,所有权限均从 AccountA 的控制台/CLI 授予:

  • 资源链接(AccountA 的 Glue 目录)上的 DESCRIBE
  • 共享数据库/表(AccountB 的 Glue Catalog)上进行 SELECTDROP 等;

资源链接权限必须成对授予:即使您的查询指向资源链接,在 Athena/Redshift Spectrum 中执行查询的主体仍然需要具有“正常”权限( AccountA 的 Lake Formation 管理员授予对底层共享数据库/表的 SELECTINSERT 等权限。

对于 AWS Wrangler 部分,如果问题仍然存在,也许您需要明确它将执行查询的 Glue Catalog ID(目前我不确定 AWS Wrangler 中是否存在此参数) 。

Make sure your Lambda/Glue Job execution Roles have the following Lake Formation permissions, all granted from AccountA's Console/CLI:

  • DESCRIBE on Resource Links (AccountA's Glue Catalog);
  • SELECT, DROP, etc, on the Shared DB/Table (AccountB's Glue Catalog);

Resource Link permissions must be granted in pairs: even though your queries point to a Resource Link the Principal executing the query in Athena/Redshift Spectrum still needs to have "normal" (SELECT, INSERT, etc) permissions on the underlying shared Database/Table granted by AccountA's Lake Formation Administrator.

For the AWS Wrangler part, if the problem still persists, maybe you'll need to be explicit on which Glue Catalog ID it'll execute the query upon (at the moment I'm not sure if this parameter exists in AWS Wrangler though).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文