Package io.deephaven.importers
Class JdbcSchemaCreator
java.lang.Object
io.deephaven.importers.JdbcSchemaCreator
Reads a JDBC result set and attempts to infer column data types and create appropriate schema and importer
instructions. Also legalizes column names and adds corresponding ImportColumn entries for translation of column
names.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe assessment method to use when inferring schema.static interfaceA Builder object forImmutableJdbcSchemaCreatorstatic classException indicating an error during schema assessment. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected JdbcSchemaCreator.AssessmentMethodprotected booleanbestFit()static JdbcSchemaCreator.Builderbuilder()Creates a builder forJdbcSchemaCreator.protected CasingStyleprotected voidstatic io.deephaven.shadow.enterprise.org.jdom2.DocumentgetTableImportSchemaDocument(Logger log, Connection connection, ResultSetMetaData resultSetMetaData, String namespace, String tableName, String groupingColumn, String partitionColumn, String sourceName, ImportStyle importStyle, String sourcePartitionColumn, String outPackage, CasingStyle casingStyle, String replacement, int logFormat, boolean useNanos, int maxError, String arrayDelimiter, Map<String, Class<?>> targetTypeMap) protected ImportStyleInfer the schema.protected intprotected Loggerlogger()protected intmaxError()protected abstract Stringprotected SchemaCreatorUtils.OutputModepassword()protected io.deephaven.shadow.enterprise.com.illumon.util.progress.StatusCallbackprogress()protected Stringprotected abstract StringsqlQuery()protected abstract Stringprotected booleanuseNanos()user()
-
Constructor Details
-
JdbcSchemaCreator
public JdbcSchemaCreator()
-
-
Method Details
-
builder
Creates a builder forJdbcSchemaCreator.- Returns:
- the new builder
-
logger
-
progress
@Default protected io.deephaven.shadow.enterprise.com.illumon.util.progress.StatusCallback progress() -
namespace
-
tableName
-
groupingColumn
-
partitionColumn
-
sourceName
-
jdbcDriver
-
connectionUrl
-
user
-
password
-
sqlQuery
-
outPackage
-
schemaPath
-
assessmentMethod
-
sourcePartitionColumn
-
importStyle
-
bestFit
@Default protected boolean bestFit() -
casingStyle
-
replacement
-
arrayDelimiter
-
outputMode
-
logFormat
@Default protected int logFormat() -
maxError
@Default protected int maxError() -
useNanos
@Default protected boolean useNanos() -
resultSet
-
checkJdbcDetails
@Check protected void checkJdbcDetails() -
getTableImportSchemaDocument
public static io.deephaven.shadow.enterprise.org.jdom2.Document getTableImportSchemaDocument(Logger log, Connection connection, ResultSetMetaData resultSetMetaData, String namespace, String tableName, String groupingColumn, String partitionColumn, String sourceName, ImportStyle importStyle, String sourcePartitionColumn, String outPackage, CasingStyle casingStyle, String replacement, int logFormat, boolean useNanos, int maxError, String arrayDelimiter, Map<String, Class<?>> targetTypeMap) - Parameters:
log- theLoggerto useconnection- the JDBCConnectionresultSetMetaData- the JDBCResultSetMetaDatanamespace- the target namespacetableName- the target table namegroupingColumn- the grouping columnpartitionColumn- the partition columnsourceName- the import source nameimportStyle- theImportStylesourcePartitionColumn- the source partition columnoutPackage- the output package for loggers/listenerscasingStyle- theCasingStylereplacement- the replacement string for invalid characters in column nameslogFormat- the log formatuseNanos- whether to use nanos for time calculationsmaxError- the maximum allowed errors, only used to add to the schema's import sourcearrayDelimiter- the array delimiter, only used to add to the schema's import sourcetargetTypeMap- a map of target column names to desired Java types- Returns:
- the schema
Document
-
inferSchemaFromJdbc
Infer the schema.- Returns:
- a String containing the inferred schema
- Throws:
SQLException- from the underlying JDBC calls
-