1

I am trying to do a select for all attributes as columnname , i was wondering if this is possible in hive, I have found out that within sql , we are able to extract its attributes as select statement.

The query i have tried is as shown below : In my hive ,

  • DB im using is : gfr_staging

  • Table : spt_myr

     SELECT COLUMN_NAME AS `Field`, COLUMN_TYPE AS `Type`
     FROM information_schema.COLUMNS  
     WHERE TABLE_SCHEMA = 'gfr_standard' AND TABLE_NAME = 'spt_myr';
    

But it returns me error. i was wondering if this is possible in hive

Farid Arshad
  • 334
  • 2
  • 14
  • Hive does not support metastore queries. If you can connect directly to it's metastore (usually MySQL or Postgres) then you can query in it. But not in Hive. – leftjoin Apr 12 '21 at 08:07
  • Yes to @leftjoin, You can connect directly to the merastore DB and get the info. Also you can write a program to collect all info and store in hive to query if needed. – Koushik Roy Apr 12 '21 at 08:10
  • Some examples of parsing DESCRIBE: https://stackoverflow.com/a/45053915/2700344, https://stackoverflow.com/a/58012261/2700344, parsing show partitions: https://stackoverflow.com/a/58398209/2700344 – leftjoin Apr 12 '21 at 09:29

0 Answers0