‘sqoop codegen’ command is used to generate Java POJOs from the database.
Example
sqoop codegen \
--connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
--username root \
--password "cloudera" \
--table customers
$ sqoop codegen \
> --connect "jdbc:mysql://quickstart.cloudera:3306/retail_db" \
> --username root \
> --password "cloudera" \
> --table customers
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
22/04/08 23:34:50 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.13.0
22/04/08 23:34:50 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
22/04/08 23:34:50 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
22/04/08 23:34:50 INFO tool.CodeGenTool: Beginning code generation
22/04/08 23:34:51 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `customers` AS t LIMIT 1
22/04/08 23:34:51 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `customers` AS t LIMIT 1
22/04/08 23:34:51 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-mapreduce
Note: /tmp/sqoop-cloudera/compile/d8f6b801e838e3e21696f5537e9f97d8/customers.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
22/04/08 23:34:52 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-cloudera/compile/d8f6b801e838e3e21696f5537e9f97d8/customers.jar
From the
output, you can get the location of customer.java file. In my case it is generated at
Previous Next Home
No comments:
Post a Comment