我通过以下查询在 Hive 中获取表的详细信息,但在 Athena 中没有找到相应的信息。
use schema_name;
SHOW TABLE EXTENDED LIKE '*'
Run Code Online (Sandbox Code Playgroud)
作为上述查询输出的一部分,我将获取每个表名称的以下属性的值。 表名称、所有者、位置、输入格式、输出格式、分区、分区列、totalFileSize、maxFileSize、minFileSize、lastAccessTime、lastUpdateTime
想要在 Athena 中获得上述所有详细信息,这就是我正在遵循的方法。
SELECT table_name FROM information_schema.tables WHERE table_schema = 'logging' // Lists all the tables under logging schema.
DESCRIBE EXTENDED AwsDataCatalog.logging.logtable1; // Getting the details in plain text per table, can parse and some how we can fetch relevant data. Do the same for all other tables under schema.
Run Code Online (Sandbox Code Playgroud)
上述查询的局限性是,我们必须对每个表执行查询,而不是一次性获取所有表的详细信息。
有没有更好的方法来查询和获取所需的信息?
任何人都可以建议我如何解析以下命令输出并将特定值存储在变量中。
塞斯塔图斯
这是该命令的输出
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
Run Code Online (Sandbox Code Playgroud)
在这里,我想将“当前模式”的“强制”存储在一个变量中。
谁能建议我。
提前致谢。