Support Questions

Find answers, ask questions, and share your expertise

Sqoop get table schema with data types

avatar
Rising Star

Hi,

I am trying to get table schema from source system with data types, is is possible with sqoop commands??

Right now I am using sqoop eval, which gets list of columns only, but need data types as well??

kindly let me know if any solution??

Regards

Mamta Chawla

1 REPLY 1

avatar
Super Collaborator

Hi @Mamta Chawla,

To get the table schema, we can easily achieved by respective command line utility ( like Bteq,sqlplus or mysql client etc..), sqoop can be handy to pull the larger volumes of data across the RDBMS to HDFS.

However, if you want to store the schema information in Hadoop as files using the sqoop, this can be achieved by querying the database metadata tables.

for instance :

select * from all_tab_columns where owner = '<OWENR_NAME>' and table_name = 'YOUR TABLE NAME HERE';  --for Oracle
select * from DBC.columns where databasename ='<Database_Name>' and tablename ='<Table_name>';       --for Teradata
SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_name' AND table_schema = 'db_name';-- for Mysql .. etc

Hope this helps !!