配置单元元存储客户端获取最后一个DDL时间戳

2024-05-18 11:05:34 发布

您现在位置:Python中文网/ 问答频道 /正文

this answerthis answer中,我们可以通过HiveQL获得表的最后更新时间戳

show TBLPROPERTIES table_name ('transient_lastDdlTime');

然而,我正在使用python中的ThriftHiveMetastore.client,通过它我找不到任何关于ddl时间戳的信息。我指的是the following docs

我正在使用hmsclient,它是ThriftHiveMetastore.client上非常薄的包装

client = hmsclient.HMSClient(host='xxx', port=yyy)
with client as c:
    tbl = c.get_table("default", "some_table")
    print(dir(tbl))
    print(tbl.lastAccessTime)

输出(格式化为可读性):

['__class__', 
'__delattr__', 
...
'createTime', 
'dbName', 
'lastAccessTime', 
'owner', 
'parameters', 
'partitionKeys', 
'privileges', 
'read', 
'retention', 
'rewriteEnabled', 
'sd', 
'tableName', 
'tableType', 
'temporary', 
'thrift_spec', 
'validate', 
'viewExpandedText', 
'viewOriginalText', 
'write']
0

除了lastAccessTime是0之外,我没有看到其他任何东西


Tags: answernameclientshow时间tablethisprint