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?
LVL 17
MIKESoftware Solutions ConsultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
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.
NerdsOfTechTechnology ScientistCommented:
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

SharathData EngineerCommented:
Hive metadata is stored in databases like MySQL. If you have access, you can query that.
Otherwise, you need to get that with hive queries like  hive -e "use dbname; describe formatted table_name"
You need to write custom shell script to get this info and check if specified column is there. Of course, the command has to be executed in a loop for all tables. let me know if you need any help further.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Big Data

From novice to tech pro — start learning today.