Link to home
Start Free TrialLog in
Avatar of Marcus Aurelius
Marcus AureliusFlag for United States of America

asked on

Hive, How to Search using Column Name for all table in the DB that contain that Column Name?

Hive. How can I search for all tables in a database that contain a Column Name?
Avatar of Qlemo
Qlemo
Flag of Germany image

I don't know Apache Hive, but from what I read it stores metadata in a different database (Derby by default) you need to connect to separately, at least with 2.3 (https://stackoverflow.com/questions/20686019/how-to-display-information-schema-using-hive). I could not find anything in the release notes of 3.0 about a change.
ain the repository you should have the standard information_schema views available to retrieve table and column info as with other databases.
I'm wondering if your version allows:

SELECT DISTINCT TABLE_NAME 
 FROM INFORMATION_SCHEMA.COLUMNS
 WHERE COLUMN_NAME IN ('columnNameSearch')
     AND TABLE_SCHEMA='YourDatabase';

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial