0

In Impala, is it possible to list all tables in a given database with the date each table is created? Something like:

In my_database:

TABLE     CREATED_DATE
-----------------------
table_1   2016-01-01
table_2   2016-02-12
table_3   2016-05-03

Thanks a lot!

2 Answers 2

6

I don't Think there is a specific command to do what you are asking for:

What we usually do is to list all tables in a given DB:

show tables in db_name

then for each table we run:

show create table table_name

look for the propery transient_lastDdlTime'='1479222568' which shows the timestamp of the creation time. you'll have to change that to a "readable date".

You can do this easily on a python script, installing pyodbc package and cloudera Impala ODBC driver.

2

This is actually trivially easy with one huge but. With direct READONLY access to the Hive metastore - which may cause additional load that could affect impala and hive performance - you can query table properties directly.

The metastore may be built on a number of different databases - mysql and postgres are both options I believe. Here is an example from my postgres based Metastore.

select "TBL_NAME", "CREATE_TIME" from "TBLS" limit 10;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.