pythonhivehcatalog

Trigger to HCATALOG


Can I add a trigger to HCATALOG to track any changes to HIVE tables? I want to notify an audience about the HIVE table changes. If adding triggers is not possible, what are the other approaches?


Solution

  • You can query the Hive metastore as below

    Example Query

    SELECT d.*, t.* 
      FROM hive.TBLS t
      JOIN hive.DBS d
        ON t.DB_ID = d.DB_ID
     WHERE t.CREATE_TIME BETWEEN unix_timestamp('01-Dec-15  10.00.00', 'dd-MMM-yy hh.mm.ss')
                             AND unix_timestamp('07-Dec-15  10.00.00', 'dd-MMM-yy hh.mm.ss');
    

    This query gives you all tables created between 1st Dec 10AM to 7th Dec 10AM.

    SELECT the columns you are interested in.

    Hope this helps