public class DbSinkOptions<R,C>
extends java.lang.Object
This is open source software released under the Apache 2.0 License
| Modifier and Type | Class | Description |
|---|---|---|
class |
DbSinkOptions.ColumnMappings |
A class that maintains a mapping between a DataFrame column type and a JDBC column type
|
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.String |
autoIncrementColumnName |
|
private int |
batchSize |
|
private DbSinkOptions.ColumnMappings |
columnMappings |
|
private java.util.function.Function<C,java.lang.String> |
columnNames |
|
private java.sql.Connection |
connection |
|
private com.d3x.morpheus.util.sql.SQLPlatform |
platform |
|
private java.lang.String |
rowKeyColumn |
|
private com.d3x.morpheus.util.functions.Function1<R,?> |
rowKeyMapper |
|
private java.lang.Class<?> |
rowKeySqlClass |
|
private java.lang.String |
tableName |
| Constructor | Description |
|---|---|
DbSinkOptions() |
Constructor
|
| Modifier and Type | Method | Description |
|---|---|---|
(package private) java.util.Optional<java.lang.String> |
getAutoIncrementColumnName() |
Returns the optional column name for the auto increment field
|
(package private) int |
getBatchSize() |
Returns the batch size for inserts
|
DbSinkOptions.ColumnMappings |
getColumnMappings() |
Returns the column mappings for these options
|
(package private) java.util.function.Function<C,java.lang.String> |
getColumnNames() |
Returns the function that yield column names for DataFrame column keys
|
(package private) java.sql.Connection |
getConnection() |
Returns the connection for these options
|
(package private) java.util.Optional<com.d3x.morpheus.util.sql.SQLPlatform> |
getPlatform() |
Returns the SQL platform for these options
|
(package private) java.util.Optional<java.lang.String> |
getRowKeyColumn() |
Returns the column name to store DataFrame row keys in
|
(package private) java.util.Optional<com.d3x.morpheus.util.functions.Function1<R,?>> |
getRowKeyMapper() |
Returns the mapper that maps row keys to the appropriate JDBC type
|
(package private) java.util.Optional<java.lang.Class<?>> |
getRowKeySqlClass() |
Returns the SQL type to apply row keys to
|
(package private) java.lang.String |
getTableName() |
Returns the table name to write to
|
void |
setAutoIncrementColumnName(java.lang.String autoIncrementColumnName) |
Sets the name of an auto increment column name if one exists in the table
|
void |
setBatchSize(int batchSize) |
Sets the batch size for write operations
|
void |
setColumnMappings(java.util.function.Consumer<DbSinkOptions.ColumnMappings> configurator) |
Sets the column mappings for these options
|
void |
setColumnNames(java.util.function.Function<C,java.lang.String> columnNames) |
Sets the column name generating function
|
void |
setConnection(java.lang.String url,
java.lang.String username,
java.lang.String password) |
Sets the JDBC connection URL and optional credentials
This method should ideally only be used for testing, a connection pool is preferable for production
|
void |
setConnection(java.sql.Connection connection) |
Sets the JDBC connection for this request
|
void |
setConnection(javax.sql.DataSource dataSource) |
Sets the JDBC data source for this request
|
void |
setPlatform(com.d3x.morpheus.util.sql.SQLPlatform platform) |
Sets the target SQL platform for these options
|
<T> void |
setRowKeyMapping(java.lang.String colName,
java.lang.Class<T> sqlType,
com.d3x.morpheus.util.functions.Function1<R,T> mapper) |
Sets the row key mapping for these database options
|
void |
setTableName(java.lang.String tableName) |
Sets the target table name to write to
|
private int batchSize
private java.lang.String tableName
private java.sql.Connection connection
private com.d3x.morpheus.util.sql.SQLPlatform platform
private DbSinkOptions.ColumnMappings columnMappings
private java.lang.String autoIncrementColumnName
private java.util.function.Function<C,java.lang.String> columnNames
private java.lang.String rowKeyColumn
private java.lang.Class<?> rowKeySqlClass
private com.d3x.morpheus.util.functions.Function1<R,?> rowKeyMapper
int getBatchSize()
java.lang.String getTableName()
java.util.Optional<com.d3x.morpheus.util.sql.SQLPlatform> getPlatform()
java.sql.Connection getConnection()
java.util.Optional<java.lang.String> getRowKeyColumn()
java.util.Optional<java.lang.Class<?>> getRowKeySqlClass()
java.util.Optional<com.d3x.morpheus.util.functions.Function1<R,?>> getRowKeyMapper()
java.util.Optional<java.lang.String> getAutoIncrementColumnName()
public DbSinkOptions.ColumnMappings getColumnMappings()
java.util.function.Function<C,java.lang.String> getColumnNames()
public void setBatchSize(int batchSize)
batchSize - the batch sizepublic void setTableName(java.lang.String tableName)
tableName - the fully qualified table namepublic void setConnection(java.sql.Connection connection)
connection - the connection for this requestpublic void setConnection(javax.sql.DataSource dataSource)
dataSource - the DataSource the grab a connection frompublic void setConnection(java.lang.String url,
java.lang.String username,
java.lang.String password)
url - the JDBC connection urlusername - the JDBC connection username, can be nullpassword - the JDBC connection password, can be nullpublic <T> void setRowKeyMapping(java.lang.String colName,
java.lang.Class<T> sqlType,
com.d3x.morpheus.util.functions.Function1<R,T> mapper)
T - the mapped row key typecolName - the column to apply row keys tosqlType - the target SQL type for row key columnmapper - the row key mapper functionpublic void setAutoIncrementColumnName(java.lang.String autoIncrementColumnName)
autoIncrementColumnName - the auto increment column namepublic void setPlatform(com.d3x.morpheus.util.sql.SQLPlatform platform)
platform - the target SQL platformpublic void setColumnNames(java.util.function.Function<C,java.lang.String> columnNames)
columnNames - the column name generating functionpublic void setColumnMappings(java.util.function.Consumer<DbSinkOptions.ColumnMappings> configurator)
configurator - the configurator for column mappingsCopyright 2014-2018, D3X Systems