You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ja...@apache.org on 2014/10/30 15:37:40 UTC
git commit: SQOOP-1645: Update label text and (optional) required
info for the generic jdbc connector config properties
Repository: sqoop
Updated Branches:
refs/heads/sqoop2 a9bd172a9 -> ecd9cbe20
SQOOP-1645: Update label text and (optional) required info for the generic jdbc connector config properties
(Veena Basavaraj via Jarek Jarcec Cecho)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/ecd9cbe2
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/ecd9cbe2
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/ecd9cbe2
Branch: refs/heads/sqoop2
Commit: ecd9cbe209390764a20d61f898f1e423791c1045
Parents: a9bd172
Author: Jarek Jarcec Cecho <ja...@apache.org>
Authored: Thu Oct 30 07:37:05 2014 -0700
Committer: Jarek Jarcec Cecho <ja...@apache.org>
Committed: Thu Oct 30 07:37:05 2014 -0700
----------------------------------------------------------------------
.../jdbc/GenericJdbcToInitializer.java | 4 +-
.../jdbc/configuration/FromJobConfig.java | 10 ++--
.../jdbc/configuration/ToJobConfig.java | 39 +++++++++-----
.../generic-jdbc-connector-config.properties | 57 +++++++++-----------
.../sqoop/connector/jdbc/TestToInitializer.java | 6 +--
5 files changed, 61 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/sqoop/blob/ecd9cbe2/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcToInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcToInitializer.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcToInitializer.java
index 1747347..953497f 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcToInitializer.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcToInitializer.java
@@ -128,8 +128,8 @@ public class GenericJdbcToInitializer extends Initializer<LinkConfiguration, ToJ
String schemaName = toJobConfig.toJobConfig.schemaName;
String tableName = toJobConfig.toJobConfig.tableName;
String stageTableName = toJobConfig.toJobConfig.stageTableName;
- boolean clearStageTable = toJobConfig.toJobConfig.clearStageTable == null ?
- false : toJobConfig.toJobConfig.clearStageTable;
+ boolean clearStageTable = toJobConfig.toJobConfig.shouldClearStageTable == null ?
+ false : toJobConfig.toJobConfig.shouldClearStageTable;
final boolean stageEnabled =
stageTableName != null && stageTableName.length() > 0;
String tableSql = toJobConfig.toJobConfig.sql;
http://git-wip-us.apache.org/repos/asf/sqoop/blob/ecd9cbe2/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromJobConfig.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromJobConfig.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromJobConfig.java
index 12ceb21..e6e8ed4 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromJobConfig.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/FromJobConfig.java
@@ -28,7 +28,7 @@ import org.apache.sqoop.validation.validators.NullOrContains;
/**
*
*/
-@ConfigClass( validators = {@Validator(FromJobConfig.ConfigValidator.class)})
+@ConfigClass(validators = { @Validator(FromJobConfig.ConfigValidator.class) })
public class FromJobConfig {
@Input(size = 50)
public String schemaName;
@@ -36,7 +36,7 @@ public class FromJobConfig {
@Input(size = 50)
public String tableName;
- @Input(size = 2000, validators = {@Validator(value = NullOrContains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN)})
+ @Input(size = 2000, validators = { @Validator(value = NullOrContains.class, strArg = GenericJdbcConnectorConstants.SQL_CONDITIONS_TOKEN) })
public String sql;
@Input(size = 50)
@@ -54,13 +54,13 @@ public class FromJobConfig {
public static class ConfigValidator extends AbstractValidator<FromJobConfig> {
@Override
public void validate(FromJobConfig config) {
- if(config.tableName == null && config.sql == null) {
+ if (config.tableName == null && config.sql == null) {
addMessage(Status.UNACCEPTABLE, "Either table name or SQL must be specified");
}
- if(config.tableName != null && config.sql != null) {
+ if (config.tableName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
}
- if(config.schemaName != null && config.sql != null) {
+ if (config.schemaName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both schema name and SQL cannot be specified");
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/ecd9cbe2/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/ToJobConfig.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/ToJobConfig.java b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/ToJobConfig.java
index 2428601..3e55505 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/ToJobConfig.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/configuration/ToJobConfig.java
@@ -26,29 +26,42 @@ import org.apache.sqoop.validation.validators.AbstractValidator;
/**
*
*/
-@ConfigClass(validators = {@Validator(ToJobConfig.ConfigValidator.class)})
+@ConfigClass(validators = { @Validator(ToJobConfig.ConfigValidator.class) })
public class ToJobConfig {
- @Input(size = 50) public String schemaName;
- @Input(size = 2000) public String tableName;
- @Input(size = 50) public String sql;
- @Input(size = 50) public String columns;
- @Input(size = 2000) public String stageTableName;
- @Input public Boolean clearStageTable;
+ @Input(size = 50)
+ public String schemaName;
+
+ @Input(size = 2000)
+ public String tableName;
+
+ @Input(size = 50)
+ public String sql;
+
+ @Input(size = 50)
+ public String columns;
+
+ @Input(size = 2000)
+ public String stageTableName;
+
+ @Input
+ public Boolean shouldClearStageTable;
public static class ConfigValidator extends AbstractValidator<ToJobConfig> {
@Override
public void validate(ToJobConfig config) {
- if(config.tableName == null && config.sql == null) {
+ if (config.tableName == null && config.sql == null) {
addMessage(Status.UNACCEPTABLE, "Either table name or SQL must be specified");
}
- if(config.tableName != null && config.sql != null) {
+ if (config.tableName != null && config.sql != null) {
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
}
- if(config.tableName == null && config.stageTableName != null) {
- addMessage(Status.UNACCEPTABLE, "Stage table name cannot be specified without specifying table name");
+ if (config.tableName == null && config.stageTableName != null) {
+ addMessage(Status.UNACCEPTABLE,
+ "Stage table name cannot be specified without specifying table name");
}
- if(config.stageTableName == null && config.clearStageTable != null) {
- addMessage(Status.UNACCEPTABLE, "Clear stage table cannot be specified without specifying name of the stage table.");
+ if (config.stageTableName == null && config.shouldClearStageTable != null) {
+ addMessage(Status.UNACCEPTABLE,
+ "Should Clear stage table cannot be specified without specifying the name of the stage table.");
}
}
}
http://git-wip-us.apache.org/repos/asf/sqoop/blob/ecd9cbe2/connector/connector-generic-jdbc/src/main/resources/generic-jdbc-connector-config.properties
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/resources/generic-jdbc-connector-config.properties b/connector/connector-generic-jdbc/src/main/resources/generic-jdbc-connector-config.properties
index c535e9b..6a2159b 100644
--- a/connector/connector-generic-jdbc/src/main/resources/generic-jdbc-connector-config.properties
+++ b/connector/connector-generic-jdbc/src/main/resources/generic-jdbc-connector-config.properties
@@ -20,17 +20,18 @@
#
linkConfig.label = Link configuration
linkConfig.help = You must supply the information requested in order to \
- create a connection object.
+ create a link object.
# jdbc driver
linkConfig.jdbcDriver.label = JDBC Driver Class
linkConfig.jdbcDriver.help = Enter the fully qualified class name of the JDBC \
- driver that will be used for establishing this connection.
+ driver that will be used for establishing this connection.\
+ Note: The driver jar must be in the sqoop lib directory.
# connect string
linkConfig.connectionString.label = JDBC Connection String
linkConfig.connectionString.help = Enter the value of JDBC connection string to be \
- used by this connector for creating connections.
+ used by this connector for creating database connections.
# username string
linkConfig.username.label = Username
@@ -50,78 +51,70 @@ linkConfig.jdbcProperties.help = Enter any JDBC properties that should be \
# From Job Config
#
fromJobConfig.label = From database configuration
-fromJobConfig.help = You must supply the information requested in order to create \
- a job object.
+fromJobConfig.help = You must supply the information requested below in order to create \
+ the FROM part of the job object
# From schema name
fromJobConfig.schemaName.label = Schema name
-fromJobConfig.schemaName.help = Schema name to process data in the remote database
+fromJobConfig.schemaName.help = Schema name to read data from
# From table name
fromJobConfig.tableName.label = Table name
-fromJobConfig.tableName.help = Table name to process data in the remote database
+fromJobConfig.tableName.help = Table name to read data from
# From table SQL
fromJobConfig.sql.label = Table SQL statement
-fromJobConfig.sql.help = SQL statement to process data in the remote database
+fromJobConfig.sql.help = SQL statement to read data from (Optional if table name is already given)
# From table columns
fromJobConfig.columns.label = Table column names
-fromJobConfig.columns.help = Specific columns of a table name or a table SQL
+fromJobConfig.columns.help = Specific columns in the given table name or the SQL query (Optional)
-# From table warehouse
-fromJobConfig.warehouse.label = Data warehouse
-fromJobConfig.warehouse.help = The root directory for data
-
-# From table datadir
-fromJobConfig.dataDirectory.label = Data directory
-fromJobConfig.dataDirectory.help = The sub-directory under warehouse for data
-
-# From table pcol
+# From table partition column
fromJobConfig.partitionColumn.label = Partition column name
-fromJobConfig.partitionColumn.help = A specific column for data partition
+fromJobConfig.partitionColumn.help = A specific column for data partition (Optional)
-# From table pcol is null
-fromJobConfig.partitionColumnNull.label = Nulls in partition column
-fromJobConfig.partitionColumnNull.help = Whether there are null values in partition column
+# From table allow nulls in partition column
+fromJobConfig.allowNullValueInPartitionColumn.label = Null value allowed for the partition column
+fromJobConfig.allowNullValueInPartitionColumn.help = Whether there are null values in partition column (Defaults to false)
# From table boundary
fromJobConfig.boundaryQuery.label = Boundary query
-fromJobConfig.boundaryQuery.help = The boundary query for data partition
+fromJobConfig.boundaryQuery.help = The boundary query for data partition (Optional)
# ToJob Config
#
toJobConfig.label = To database configuration
toJobConfig.help = You must supply the information requested in order to create \
- a job object.
+ the TO part of the job object.
# To schema name
toJobConfig.schemaName.label = Schema name
-toJobConfig.schemaName.help = Schema name to process data in the remote database
+toJobConfig.schemaName.help = Schema name to write data into
# To table name
toJobConfig.tableName.label = Table name
-toJobConfig.tableName.help = Table name to process data in the remote database
+toJobConfig.tableName.help = Table name to write data into
# To table SQL
toJobConfig.sql.label = Table SQL statement
-toJobConfig.sql.help = SQL statement to process data in the remote database
+toJobConfig.sql.help = SQL statement to use to write data into (Optional if table name is already given)
# To table columns
toJobConfig.columns.label = Table column names
-toJobConfig.columns.help = Specific columns of a table name or a table SQL
+toJobConfig.columns.help = Specific columns to use in the given table name or the table SQL (Optional)
# To stage table name
toJobConfig.stageTableName.label = Stage table name
-toJobConfig.stageTableName.help = Name of the stage table to use
+toJobConfig.stageTableName.help = Name of the staging table to use (Optional)
# To clear stage table
-toJobConfig.clearStageTable.label = Clear stage table
-toJobConfig.clearStageTable.help = Indicate if the stage table should be cleared
+toJobConfig.shouldClearStageTable.label = Should clear stage table
+toJobConfig.shouldClearStageTable.help = Indicate if the stage table should be cleared (Defaults to false)
# Placeholders to have some entities created
ignored.label = Ignored
ignored.help = This is completely ignored
ignored.ignored.label = Ignored
-ignored.ignored.help = This is completely ignored
+ignored.ignored.help = This is completely ignored
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sqoop/blob/ecd9cbe2/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
index 243de01..faf553d 100644
--- a/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
+++ b/connector/connector-generic-jdbc/src/test/java/org/apache/sqoop/connector/jdbc/TestToInitializer.java
@@ -288,7 +288,7 @@ public class TestToInitializer {
//specifying clear stage table flag without specifying name of
// the stage table
jobConfig.toJobConfig.tableName = schemalessTableName;
- jobConfig.toJobConfig.clearStageTable = false;
+ jobConfig.toJobConfig.shouldClearStageTable = false;
ConfigValidationRunner validationRunner = new ConfigValidationRunner();
ConfigValidationResult result = validationRunner.validate(jobConfig);
assertEquals("User should not specify clear stage table flag without " +
@@ -298,7 +298,7 @@ public class TestToInitializer {
assertTrue(result.getMessages().containsKey(
"toJobConfig"));
- jobConfig.toJobConfig.clearStageTable = true;
+ jobConfig.toJobConfig.shouldClearStageTable = true;
result = validationRunner.validate(jobConfig);
assertEquals("User should not specify clear stage table flag without " +
"specifying name of the stage table",
@@ -339,7 +339,7 @@ public class TestToInitializer {
linkConfig.linkConfig.connectionString = GenericJdbcTestConstants.URL;
jobConfig.toJobConfig.tableName = schemalessTableName;
jobConfig.toJobConfig.stageTableName = stageTableName;
- jobConfig.toJobConfig.clearStageTable = true;
+ jobConfig.toJobConfig.shouldClearStageTable = true;
createTable(fullStageTableName);
executor.executeUpdate("INSERT INTO " + fullStageTableName +
" VALUES(1, 1.1, 'one')");