|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cloudera.sqoop.manager.ConnManager
public abstract class ConnManager
Abstract interface that manages connections to a database. The implementations of this class drive the actual discussion with the database about table formats, etc.
Constructor Summary | |
---|---|
ConnManager()
|
Method Summary | |
---|---|
abstract void |
close()
Perform any shutdown operations on the connection. |
java.lang.String |
escapeColName(java.lang.String colName)
When using a column name in a generated SQL query, how (if at all) should we escape that column name? e.g., a column named "table" may need to be quoted with backtiks: "`table`". |
java.lang.String |
escapeTableName(java.lang.String tableName)
When using a table name in a generated SQL query, how (if at all) should we escape that column name? e.g., a table named "table" may need to be quoted with backtiks: "`table`". |
abstract void |
execAndPrint(java.lang.String s)
Execute a SQL statement 's' and print its results to stdout. |
void |
exportTable(ExportJobContext context)
Export data stored in HDFS into a table in a database. |
abstract java.lang.String[] |
getColumnNames(java.lang.String tableName)
Return a list of column names in a table in the order returned by the db. |
abstract java.util.Map<java.lang.String,java.lang.Integer> |
getColumnTypes(java.lang.String tableName)
Return an unordered mapping from colname to sqltype for all columns in a table. |
abstract java.sql.Connection |
getConnection()
|
abstract java.lang.String |
getDriverClass()
|
abstract java.lang.String |
getPrimaryKey(java.lang.String tableName)
Return the name of the primary key for a table, or null if there is none. |
abstract void |
importTable(ImportJobContext context)
Perform an import of a table from the database into HDFS. |
abstract java.lang.String[] |
listDatabases()
Return a list of all databases on a server. |
abstract java.lang.String[] |
listTables()
Return a list of all tables in a database. |
abstract java.sql.ResultSet |
readTable(java.lang.String tableName,
java.lang.String[] columns)
Execute a SQL statement to read the named set of columns from a table. |
abstract void |
release()
If a method of this ConnManager has returned a ResultSet to you, you are responsible for calling release() after you close the ResultSet object, to free internal resources. |
abstract java.lang.String |
toHiveType(int sqlType)
Return hive type for SQL type. |
abstract java.lang.String |
toJavaType(int sqlType)
Return java type for SQL type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnManager()
Method Detail |
---|
public abstract java.lang.String[] listDatabases()
public abstract java.lang.String[] listTables()
public abstract java.lang.String[] getColumnNames(java.lang.String tableName)
public abstract java.lang.String getPrimaryKey(java.lang.String tableName)
public abstract java.lang.String toJavaType(int sqlType)
sqlType
- sql type
public abstract java.lang.String toHiveType(int sqlType)
sqlType
- sql type
public abstract java.util.Map<java.lang.String,java.lang.Integer> getColumnTypes(java.lang.String tableName)
public abstract java.sql.ResultSet readTable(java.lang.String tableName, java.lang.String[] columns) throws java.sql.SQLException
java.sql.SQLException
public abstract java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public abstract java.lang.String getDriverClass()
public abstract void execAndPrint(java.lang.String s)
public abstract void importTable(ImportJobContext context) throws java.io.IOException, ImportException
java.io.IOException
ImportException
public java.lang.String escapeColName(java.lang.String colName)
colName
- the column name as provided by the user, etc.
public java.lang.String escapeTableName(java.lang.String tableName)
tableName
- the table name as provided by the user, etc.
public abstract void close() throws java.sql.SQLException
java.sql.SQLException
public void exportTable(ExportJobContext context) throws java.io.IOException, ExportException
java.io.IOException
ExportException
public abstract void release()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |