R - the row key type
This is open source software released under the Apache 2.0 License
com.d3x.morpheus.frame.DataFrameSource.Options<R,java.lang.String>public class DbSourceOptions<R>
extends java.lang.Object
implements com.d3x.morpheus.frame.DataFrameSource.Options<R,java.lang.String>
| Modifier and Type | Field | Description |
|---|---|---|
private boolean |
autoCommit |
|
private java.sql.Connection |
connection |
|
private java.util.Set<java.lang.String> |
excludeColumnSet |
|
private java.util.Map<java.lang.String,com.d3x.morpheus.util.sql.SQLExtractor> |
extractorMap |
|
private int |
fetchSize |
|
private java.lang.Object[] |
parameters |
|
private boolean |
readOnly |
|
private int |
rowCapacity |
|
private java.util.function.Function<java.sql.ResultSet,R> |
rowKeyFunction |
|
private java.lang.String |
sql |
| Constructor | Description |
|---|---|
DbSourceOptions() |
Constructor
|
| Modifier and Type | Method | Description |
|---|---|---|
(package private) java.sql.Connection |
getConnection() |
Returns the connection for this request
|
(package private) java.util.Set<java.lang.String> |
getExcludeColumnSet() |
Returns the set of columns to exclude
|
(package private) java.util.Map<java.lang.String,com.d3x.morpheus.util.sql.SQLExtractor> |
getExtractors() |
Returns the apply of extractors for this request
|
(package private) java.util.Optional<java.lang.Integer> |
getFetchSize() |
Returns the statement fetch size for queries
|
(package private) java.util.Optional<java.lang.Object[]> |
getParameters() |
Returns the parameters for this request
|
(package private) int |
getRowCapacity() |
Returns the initial row capacity to size the resulting DataFrame
|
(package private) java.util.function.Function<java.sql.ResultSet,R> |
getRowKeyFunction() |
Returns the row key generating function for this request
|
java.lang.String |
getSql() |
Returns the SQL query for this request
|
(package private) boolean |
isAutoCommit() |
Returns the connection auto commit preference
|
(package private) boolean |
isReadOnly() |
Returns the connection read only setting
|
void |
validate() |
|
DbSourceOptions<R> |
withAutoCommit(boolean autoCommit) |
Sets the connection auto commit state
|
DbSourceOptions<R> |
withConnection(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
|
DbSourceOptions<R> |
withConnection(java.sql.Connection connection) |
Sets the JDBC connection for this request
|
DbSourceOptions<R> |
withConnection(javax.sql.DataSource dataSource) |
Sets the JDBC connection for this request
|
DbSourceOptions<R> |
withExcludeColumns(java.lang.String... columns) |
Sets the names of columns not to include in the resulting DataFrame
|
DbSourceOptions<R> |
withExtractor(java.lang.String colName,
com.d3x.morpheus.util.sql.SQLExtractor extractor) |
Sets the extractor to use for the column name
|
DbSourceOptions<R> |
withFetchSize(int fetchSize) |
Sets the fetch size for the statement when executing queries
|
DbSourceOptions<R> |
withParameters(java.lang.Object... parameters) |
Sets the parameters for the SQL expression
|
DbSourceOptions<R> |
withReadOnly(boolean readOnly) |
Sets the connection read only setting
|
DbSourceOptions<R> |
withRowCapacity(int rowCapacity) |
Sets the initial row capacity to size the DataFrame
|
DbSourceOptions<R> |
withRowKeyFunction(java.util.function.Function<java.sql.ResultSet,R> rowKeyFunction) |
Sets the row key function for this request
|
DbSourceOptions<R> |
withSql(java.lang.String sql) |
Sets the SQL query for this request
|
private java.lang.String sql
private int rowCapacity
private int fetchSize
private java.sql.Connection connection
private java.lang.Object[] parameters
private boolean autoCommit
private boolean readOnly
private java.util.Set<java.lang.String> excludeColumnSet
private java.util.function.Function<java.sql.ResultSet,R> rowKeyFunction
private java.util.Map<java.lang.String,com.d3x.morpheus.util.sql.SQLExtractor> extractorMap
public void validate()
validate in interface com.d3x.morpheus.frame.DataFrameSource.Options<R,java.lang.String>public DbSourceOptions<R> withSql(java.lang.String sql)
sql - the sql for this requestpublic DbSourceOptions<R> withParameters(java.lang.Object... parameters)
parameters - the SQL parameterspublic DbSourceOptions<R> withConnection(java.sql.Connection connection)
connection - the connection for this requestpublic DbSourceOptions<R> withConnection(javax.sql.DataSource dataSource)
dataSource - the DataSource the grab a connection frompublic DbSourceOptions<R> withConnection(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 DbSourceOptions<R> withExcludeColumns(java.lang.String... columns)
columns - the columns to exlcude from DataFramepublic DbSourceOptions<R> withRowKeyFunction(java.util.function.Function<java.sql.ResultSet,R> rowKeyFunction)
rowKeyFunction - the row key functionpublic DbSourceOptions<R> withRowCapacity(int rowCapacity)
rowCapacity - the initial roe capacitypublic DbSourceOptions<R> withFetchSize(int fetchSize)
fetchSize - the fetch sizepublic DbSourceOptions<R> withAutoCommit(boolean autoCommit)
autoCommit - true to enable auto commitpublic DbSourceOptions<R> withReadOnly(boolean readOnly)
readOnly - true for read onlypublic DbSourceOptions<R> withExtractor(java.lang.String colName, com.d3x.morpheus.util.sql.SQLExtractor extractor)
colName - the JDBC column nameextractor - the extractor to use for columnpublic java.lang.String getSql()
java.util.Optional<java.lang.Object[]> getParameters()
java.sql.Connection getConnection()
int getRowCapacity()
boolean isAutoCommit()
boolean isReadOnly()
java.util.Set<java.lang.String> getExcludeColumnSet()
java.util.Optional<java.lang.Integer> getFetchSize()
java.util.function.Function<java.sql.ResultSet,R> getRowKeyFunction()
java.util.Map<java.lang.String,com.d3x.morpheus.util.sql.SQLExtractor> getExtractors()
Copyright 2014-2018, D3X Systems