簡體   English   中英

在一次調用中僅顯示 AWS athena 中的真實表

[英]show only true tables in AWS athena in one call

我試圖弄清楚如何在一次調用中列出 AWS 中 athena 數據庫的所有表。 這是我嘗試過的:

SHOW TABLES ,這將列出該特定數據庫中的所有表以及所有視圖。 我只想擁有實際的表格,而不是視圖。

我正在考慮的另一種方法是使用嵌套語句,例如with views as (SHOW VIEWS) SHOW TABLES NOT IN views 但是,您似乎不能在嵌套語句中使用這些 DDL。

有什么解決辦法嗎?

您可以使用information_schema

select *
from information_schema.tables t
where not exists (
        select v.table_name
        from information_schema.views v
        where v.table_schema = t.table_schema
            and v.table_name = t.table_name
    )

可能您需要在table_schema上添加過濾以排除不相關的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM