Return-Path: Delivered-To: apmail-hadoop-core-dev-archive@www.apache.org Received: (qmail 64869 invoked from network); 12 May 2009 17:56:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 May 2009 17:56:13 -0000 Received: (qmail 34213 invoked by uid 500); 12 May 2009 17:56:11 -0000 Delivered-To: apmail-hadoop-core-dev-archive@hadoop.apache.org Received: (qmail 34107 invoked by uid 500); 12 May 2009 17:56:10 -0000 Mailing-List: contact core-dev-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-dev@hadoop.apache.org Received: (qmail 34091 invoked by uid 99); 12 May 2009 17:56:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 17:56:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 May 2009 17:56:06 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BFE96234C052 for ; Tue, 12 May 2009 10:55:45 -0700 (PDT) Message-ID: <795924165.1242150945785.JavaMail.jira@brutus> Date: Tue, 12 May 2009 10:55:45 -0700 (PDT) From: "Aaron Kimball (JIRA)" To: core-dev@hadoop.apache.org Subject: [jira] Updated: (HADOOP-5815) Sqoop: A database import tool for Hadoop In-Reply-To: <1535689691.1242150945767.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-5815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Aaron Kimball updated HADOOP-5815: ---------------------------------- Attachment: HADOOP-5815.patch Attaching patch that contains sqoop; adds project to src/contrib/sqoop/ > Sqoop: A database import tool for Hadoop > ---------------------------------------- > > Key: HADOOP-5815 > URL: https://issues.apache.org/jira/browse/HADOOP-5815 > Project: Hadoop Core > Issue Type: New Feature > Reporter: Aaron Kimball > Assignee: Aaron Kimball > Attachments: HADOOP-5815.patch > > > Overview: > Sqoop is a tool designed to help users import existing relational databases into their Hadoop clusters. Sqoop uses JDBC to connect to a database, examine the schema for tables, and auto-generate the necessary classes to import data into HDFS. It then instantiates a MapReduce job to read the table from the database via the DBInputFormat (JDBC-based InputFormat). The table is read into a set of files loaded into HDFS. Both SequenceFile and text-based targets are supported. > Longer term, Sqoop will support automatic connectivity to Hive, with the ability to load data files directly into the Hive warehouse directory, and also to inject the appropriate table definition into the metastore. > Some more specifics: > Sqoop is a program implemented as a contrib module. Its frontend is invoked through "bin/hadoop jar sqoop.jar ..." and allows you to connect to arbitrary JDBC databases and extract their tables into files in HDFS. The underlying implementation utilizes the JDBC interface of HADOOP-2536 (DBInputFormat). The DBWritable implementation needed to extract a table is generated by this tool, based on the types of the columns seen in the table. Sqoop uses JDBC to examine the table specification and translate this to the appropriate Java types. > The generated classes are provided as .java files for the user to reuse. They are also compiled into a jar and used to run a MapReduce task to perform the data import. This either results in text files or SequenceFiles in HDFS. In the latter case, these Java classes are embedded into the SequenceFiles as well. > The program will extract a specific table from a database, or optionally, all tables. For a table, it can read all columns, or just a subset. Since HADOOP-2536 requires that a sorting key be specified for the import task, Sqoop will auto-detect the presence of a primary key on a table and automatically use it as the sort order; the user can also manually specify a sorting column. > Example invocations: > To import an entire database: > hadoop jar sqoop.jar org.apache.hadoop.sqoop.Sqoop --connect jdbc:mysql://db.example.com/company --all-tables > (Requires that all tables have primary keys) > To select a single table: > hadoop jar sqoop.jar org.apache.hadoop.sqoop.Sqoop --connect jdbc:mysql://db.example.com/company --table employees > To select a subset of columns from a table: > hadoop jar sqoop.jar org.apache.hadoop.sqoop.Sqoop --connect jdbc:mysql://db.example.com/company --table employees --columns "employee_id,first_name,last_name,salary,start_date" > To explicitly set the sort column, import format, and import destination (the table will go to /shared/imported_databases/employees): > hadoop jar sqoop.jar org.apache.hadoop.sqoop.Sqoop --connect jdbc:mysql://db.example.com/company --table employees --order-by employee_id --warehouse-dir /shared/imported_databases --as-sequencefile > Sqoop will automatically select the correct JDBC driver class name for HSQLdb and MySQL; this can also be explicitly set, e.g.: > hadoop jar sqoop.jar org.apache.hadoop.sqoop.Sqoop --connect jdbc:postgresql://db.example.com/company --driver org.postgresql.Driver --all-tables > Testing has been conducted with HSQLDB and MySQL. A set of unit tests covers a great deal of Sqoop's functionality, and this tool has been used in practice at Cloudera and with a few other early test users on "real" databases. > A readme file is included in the patch which contains documentation on how to use the tool. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.