deephaven.ImportTools.JdbcHelpers

Tools for reading data from a JDBC source into an in-memory Deephaven table.

CasingStyle = None

Enum of string formatting styles for use when standardizing externally supplied column names (com.illumon.iris.utils.CasingStyle)

class JdbcHelpersOptionsBuilder(*args, **kwargs)
arrayDelimiter(arrayDelimiter)

Specify the delimiter to expect when mapping JDBC String columns to Deephaven arrays. Defaults to “,”.

Parameters

arrayDelimiter – (java.lang.String) - the delimiter

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

columnNameFormat(casingStyle, replacement)
An option that will convert source JDBC column names to an alternate style using the CasingStyle class.

The default is to pass through column names as-is with a minimum of normalization. The source columns must consistently match the expected source format for the to function appropriately. See CasingStyle for more details.

Parameters
  • casingStyle – (com.illumon.iris.console.utils.CasingStyle) - if not null, CasingStyle to apply to column names - None or null = no change to casing

  • replacement – (java.lang.String) - character, or empty String, to use for replacments of space or hyphen in source column names

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

columnTargetType(columnName, targetType)
Specify the target type for the given column. For columns with multiple possible type mappings, this permits

the user to specify which Deephaven type should be used. Any columns for which a type is not specified will receive the default type mapping.

Parameters
  • columnName – (java.lang.String) - the column name

  • targetType – (java.lang.Class<?>) - the desired Deephaven column type

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

maxErrorCount(maxErrorCount)

Specify the maximum number of errors to tolerate in an import. Default is zero.

Parameters

maxErrorCount – (int) - maximum error count

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

maxRows(maxRows)
Maximum number of rows to read, defaults to no limit. A number less than zero means no limit. This is useful

to read just a sample of a given query into memory, although depending on the JDBC driver used, it may be more efficient to apply a “LIMIT” operation in the query itself.

Parameters

maxRows – (long) - maximum number of rows to read

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

property readJdbcOptions

The java readJdbcOptions object.

sourceTimeZone(sourceTimeZone)
Specify the timezone to use when interpreting date-time/timestamp JDBC values. Defaults to the server

time-zone, if discoverable. Otherwise, defaults to the local time zone.

Parameters

sourceTimeZone – (java.util.TimeZone) - the source time zone

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

strict(strict)
Whether to apply strict mode when mapping from JDBC to Deephaven; for example throwing an exception if

an out-of-range value is encountered instead of truncating. Defaults to true.

Parameters

strict – (boolean) - use strict mode

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) customized options object

TimeZone = None

Java timezone class (java.util.TimeZone).

readJdbc(*args)
Return a JDBC query result as an in-memory Deephaven table.

Standard JDBC-to-Deephaven type mapping applies.

Overload 1
param jdbcDriver

(java.lang.String) - JDBC driver to use

param jdbcUrl

(java.lang.String) - JDBC URL/connection string

param user

(java.lang.String) - JDBC user

param password

(java.lang.String) - JDBC password

param query

(java.lang.String) - an SQL query

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given query

Overload 2
param jdbcDriver

(java.lang.String) - JDBC driver to use

param jdbcUrl

(java.lang.String) - JDBC URL/connection string

param user

(java.lang.String) - JDBC user

param password

(java.lang.String) - JDBC password

param query

(java.lang.String) - an SQL query

param options

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) - options to apply to the read/mapping operation

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given query

Overload 3
param jdbcDriver

(java.lang.String) - JDBC driver to use

param jdbcUrl

(java.lang.String) - JDBC URL/connection string

param query

(java.lang.String) - an SQL query

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given query

Overload 4
param jdbcDriver

(java.lang.String) - JDBC driver to use

param jdbcUrl

(java.lang.String) - JDBC URL/connection string

param query

(java.lang.String) - an SQL query

param options

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) - options to apply to the read/mapping operation

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given query

Overload 5
param jdbcDriver

(java.lang.String) - JDBC driver to use

param jdbcUrl

(java.lang.String) - JDBC URL/connection string

param user

(java.lang.String) - JDBC user

param password

(java.lang.String) - JDBC password

param catalog

(java.lang.String) - the desired JDBC system catalog (specify null for default)

param schema

(java.lang.String) - the desired JDBC schema (specify null for default)

param query

(java.lang.String) - an SQL query

param options

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) - options to apply to the read/mapping operation

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given query

Overload 6
param resultSet

(java.sql.ResultSet) - an open JDBC ResultSet

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given ResultSet

Overload 7
param resultSet

(java.sql.ResultSet) - an open JDBC ResultSet

param progress

(com.illumon.util.progress.StatusCallback) - status callback

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given ResultSet

Overload 8
param resultSet

(java.sql.ResultSet) - an open JDBC ResultSet

param options

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) - options to apply to the read/mapping operation

param progress

(com.illumon.util.progress.StatusCallback) - status callback

return

(com.illumon.iris.db.tables.Table) in memory table with results of the given ResultSet

readJdbcOptions()

Returns a new options object that the user can use to customize a readJdbc operation.

Returns

(com.illumon.iris.db.tables.utils.JdbcHelpers.ReadJdbcOptions) a new ReadJdbcOptions object