mirror of
https://github.com/apache/sqoop.git
synced 2025-05-19 10:21:14 +08:00
SQOOP-1645: Update label text and (optional) required info for the generic jdbc connector config properties
(Veena Basavaraj via Jarek Jarcec Cecho)
This commit is contained in:
parent
753f991fc2
commit
f5d29aec86
@ -128,8 +128,8 @@ private void configureTableProperties(MutableContext context, LinkConfiguration
|
|||||||
String schemaName = toJobConfig.toJobConfig.schemaName;
|
String schemaName = toJobConfig.toJobConfig.schemaName;
|
||||||
String tableName = toJobConfig.toJobConfig.tableName;
|
String tableName = toJobConfig.toJobConfig.tableName;
|
||||||
String stageTableName = toJobConfig.toJobConfig.stageTableName;
|
String stageTableName = toJobConfig.toJobConfig.stageTableName;
|
||||||
boolean clearStageTable = toJobConfig.toJobConfig.clearStageTable == null ?
|
boolean clearStageTable = toJobConfig.toJobConfig.shouldClearStageTable == null ?
|
||||||
false : toJobConfig.toJobConfig.clearStageTable;
|
false : toJobConfig.toJobConfig.shouldClearStageTable;
|
||||||
final boolean stageEnabled =
|
final boolean stageEnabled =
|
||||||
stageTableName != null && stageTableName.length() > 0;
|
stageTableName != null && stageTableName.length() > 0;
|
||||||
String tableSql = toJobConfig.toJobConfig.sql;
|
String tableSql = toJobConfig.toJobConfig.sql;
|
||||||
|
@ -28,12 +28,23 @@
|
|||||||
*/
|
*/
|
||||||
@ConfigClass(validators = { @Validator(ToJobConfig.ConfigValidator.class) })
|
@ConfigClass(validators = { @Validator(ToJobConfig.ConfigValidator.class) })
|
||||||
public class ToJobConfig {
|
public class ToJobConfig {
|
||||||
@Input(size = 50) public String schemaName;
|
@Input(size = 50)
|
||||||
@Input(size = 2000) public String tableName;
|
public String schemaName;
|
||||||
@Input(size = 50) public String sql;
|
|
||||||
@Input(size = 50) public String columns;
|
@Input(size = 2000)
|
||||||
@Input(size = 2000) public String stageTableName;
|
public String tableName;
|
||||||
@Input public Boolean clearStageTable;
|
|
||||||
|
@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> {
|
public static class ConfigValidator extends AbstractValidator<ToJobConfig> {
|
||||||
@Override
|
@Override
|
||||||
@ -45,10 +56,12 @@ public void validate(ToJobConfig config) {
|
|||||||
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
|
addMessage(Status.UNACCEPTABLE, "Both table name and SQL cannot be specified");
|
||||||
}
|
}
|
||||||
if (config.tableName == null && config.stageTableName != null) {
|
if (config.tableName == null && config.stageTableName != null) {
|
||||||
addMessage(Status.UNACCEPTABLE, "Stage table name cannot be specified without specifying table name");
|
addMessage(Status.UNACCEPTABLE,
|
||||||
|
"Stage table name cannot be specified without specifying table name");
|
||||||
}
|
}
|
||||||
if(config.stageTableName == null && config.clearStageTable != null) {
|
if (config.stageTableName == null && config.shouldClearStageTable != null) {
|
||||||
addMessage(Status.UNACCEPTABLE, "Clear stage table cannot be specified without specifying name of the stage table.");
|
addMessage(Status.UNACCEPTABLE,
|
||||||
|
"Should Clear stage table cannot be specified without specifying the name of the stage table.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,17 +20,18 @@
|
|||||||
#
|
#
|
||||||
linkConfig.label = Link configuration
|
linkConfig.label = Link configuration
|
||||||
linkConfig.help = You must supply the information requested in order to \
|
linkConfig.help = You must supply the information requested in order to \
|
||||||
create a connection object.
|
create a link object.
|
||||||
|
|
||||||
# jdbc driver
|
# jdbc driver
|
||||||
linkConfig.jdbcDriver.label = JDBC Driver Class
|
linkConfig.jdbcDriver.label = JDBC Driver Class
|
||||||
linkConfig.jdbcDriver.help = Enter the fully qualified class name of the JDBC \
|
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
|
# connect string
|
||||||
linkConfig.connectionString.label = JDBC Connection String
|
linkConfig.connectionString.label = JDBC Connection String
|
||||||
linkConfig.connectionString.help = Enter the value of JDBC connection string to be \
|
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
|
# username string
|
||||||
linkConfig.username.label = Username
|
linkConfig.username.label = Username
|
||||||
@ -50,74 +51,66 @@ linkConfig.jdbcProperties.help = Enter any JDBC properties that should be \
|
|||||||
# From Job Config
|
# From Job Config
|
||||||
#
|
#
|
||||||
fromJobConfig.label = From database configuration
|
fromJobConfig.label = From database configuration
|
||||||
fromJobConfig.help = You must supply the information requested in order to create \
|
fromJobConfig.help = You must supply the information requested below in order to create \
|
||||||
a job object.
|
the FROM part of the job object
|
||||||
|
|
||||||
# From schema name
|
# From schema name
|
||||||
fromJobConfig.schemaName.label = 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
|
# From table name
|
||||||
fromJobConfig.tableName.label = 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
|
# From table SQL
|
||||||
fromJobConfig.sql.label = Table SQL statement
|
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
|
# From table columns
|
||||||
fromJobConfig.columns.label = Table column names
|
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
|
# From table partition column
|
||||||
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
|
|
||||||
fromJobConfig.partitionColumn.label = Partition column name
|
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
|
# From table allow nulls in partition column
|
||||||
fromJobConfig.partitionColumnNull.label = Nulls in partition column
|
fromJobConfig.allowNullValueInPartitionColumn.label = Null value allowed for the partition column
|
||||||
fromJobConfig.partitionColumnNull.help = Whether there are null values in partition column
|
fromJobConfig.allowNullValueInPartitionColumn.help = Whether there are null values in partition column (Defaults to false)
|
||||||
|
|
||||||
# From table boundary
|
# From table boundary
|
||||||
fromJobConfig.boundaryQuery.label = Boundary query
|
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
|
# ToJob Config
|
||||||
#
|
#
|
||||||
toJobConfig.label = To database configuration
|
toJobConfig.label = To database configuration
|
||||||
toJobConfig.help = You must supply the information requested in order to create \
|
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
|
# To schema name
|
||||||
toJobConfig.schemaName.label = 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
|
# To table name
|
||||||
toJobConfig.tableName.label = 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
|
# To table SQL
|
||||||
toJobConfig.sql.label = Table SQL statement
|
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
|
# To table columns
|
||||||
toJobConfig.columns.label = Table column names
|
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
|
# To stage table name
|
||||||
toJobConfig.stageTableName.label = 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
|
# To clear stage table
|
||||||
toJobConfig.clearStageTable.label = Clear stage table
|
toJobConfig.shouldClearStageTable.label = Should clear stage table
|
||||||
toJobConfig.clearStageTable.help = Indicate if the stage table should be cleared
|
toJobConfig.shouldClearStageTable.help = Indicate if the stage table should be cleared (Defaults to false)
|
||||||
|
|
||||||
# Placeholders to have some entities created
|
# Placeholders to have some entities created
|
||||||
ignored.label = Ignored
|
ignored.label = Ignored
|
||||||
|
@ -288,7 +288,7 @@ public void testClearStageTableValidation() throws Exception {
|
|||||||
//specifying clear stage table flag without specifying name of
|
//specifying clear stage table flag without specifying name of
|
||||||
// the stage table
|
// the stage table
|
||||||
jobConfig.toJobConfig.tableName = schemalessTableName;
|
jobConfig.toJobConfig.tableName = schemalessTableName;
|
||||||
jobConfig.toJobConfig.clearStageTable = false;
|
jobConfig.toJobConfig.shouldClearStageTable = false;
|
||||||
ConfigValidationRunner validationRunner = new ConfigValidationRunner();
|
ConfigValidationRunner validationRunner = new ConfigValidationRunner();
|
||||||
ConfigValidationResult result = validationRunner.validate(jobConfig);
|
ConfigValidationResult result = validationRunner.validate(jobConfig);
|
||||||
assertEquals("User should not specify clear stage table flag without " +
|
assertEquals("User should not specify clear stage table flag without " +
|
||||||
@ -298,7 +298,7 @@ public void testClearStageTableValidation() throws Exception {
|
|||||||
assertTrue(result.getMessages().containsKey(
|
assertTrue(result.getMessages().containsKey(
|
||||||
"toJobConfig"));
|
"toJobConfig"));
|
||||||
|
|
||||||
jobConfig.toJobConfig.clearStageTable = true;
|
jobConfig.toJobConfig.shouldClearStageTable = true;
|
||||||
result = validationRunner.validate(jobConfig);
|
result = validationRunner.validate(jobConfig);
|
||||||
assertEquals("User should not specify clear stage table flag without " +
|
assertEquals("User should not specify clear stage table flag without " +
|
||||||
"specifying name of the stage table",
|
"specifying name of the stage table",
|
||||||
@ -339,7 +339,7 @@ public void testClearStageTable() throws Exception {
|
|||||||
linkConfig.linkConfig.connectionString = GenericJdbcTestConstants.URL;
|
linkConfig.linkConfig.connectionString = GenericJdbcTestConstants.URL;
|
||||||
jobConfig.toJobConfig.tableName = schemalessTableName;
|
jobConfig.toJobConfig.tableName = schemalessTableName;
|
||||||
jobConfig.toJobConfig.stageTableName = stageTableName;
|
jobConfig.toJobConfig.stageTableName = stageTableName;
|
||||||
jobConfig.toJobConfig.clearStageTable = true;
|
jobConfig.toJobConfig.shouldClearStageTable = true;
|
||||||
createTable(fullStageTableName);
|
createTable(fullStageTableName);
|
||||||
executor.executeUpdate("INSERT INTO " + fullStageTableName +
|
executor.executeUpdate("INSERT INTO " + fullStageTableName +
|
||||||
" VALUES(1, 1.1, 'one')");
|
" VALUES(1, 1.1, 'one')");
|
||||||
|
Loading…
Reference in New Issue
Block a user