JDBCConnectionWrapper

This module holds a ConnectionWrapper that is used with a JDBC Connection. The module should only be used when running Jython.

class pygrametl.JDBCConnectionWrapper.BackgroundJDBCConnectionWrapper(jdbcconn, stmtcachesize=20)

Bases: object

Wrap a JDBC Connection and do all DB communication in the background.

All Dimension and FactTable communicate with the data warehouse using a ConnectionWrapper. In this way, the code for loading the DW does not have to care about which parameter format is used. This ConnectionWrapper is a special one for JDBC in Jython and does DB communication from a Thread.

Note

BackgroundJDBCConnectionWrapper is added for experiments. It is quite similar to JDBCConnectionWrapper and one of them may be removed.

Create a ConnectionWrapper around the given JDBC connection

Arguments:

  • jdbcconn: An open JDBC Connection (not a PEP249 Connection)

  • stmtcachesize: The maximum number of PreparedStatements kept open. Default: 20.

close()

Close the connection to the database,

commit()

Commit the transaction.

cursor()

Not implemented for this JDBC connection wrapper!

execute(stmt, arguments=None, namemapping=None, ignored=None)

Execute a statement.

Arguments:

  • stmt: the statement to execute

  • arguments: a mapping with the arguments. Default: None.

  • namemapping: a mapping of names such that if stmt uses %(arg)s and namemapping[arg]=arg2, the value arguments[arg2] is used instead of arguments[arg]

  • ignored: An ignored argument only present to accept the same number of arguments as ConnectionWrapper.execute

executemany(stmt, params, ignored=None)

Execute a sequence of statements.

Arguments:

  • stmt: the statement to execute

  • params: a sequence of arguments

  • ignored: An ignored argument only present to accept the same number of arguments as ConnectionWrapper.executemany

fetchalltuples()

Return all result tuples

fetchmanytuples(cnt)

Return cnt result tuples.

fetchone(names=None)

Return one result row (i.e. dict).

fetchonetuple()

Return one result tuple.

getunderlyingmodule()

Return a reference to the underlying connection’s module.

resultnames()
rollback()

Rollback the transaction.

rowcount()

Not implemented. Return 0. Should return the size of the result.

rowfactory(names=None)

Return a generator object returning result rows (i.e. dicts).

setasdefault()

Set this ConnectionWrapper as the default connection.

class pygrametl.JDBCConnectionWrapper.JDBCConnectionWrapper(jdbcconn, stmtcachesize=20)

Bases: object

Wrap a JDBC Connection.

All Dimension and FactTable communicate with the data warehouse using a ConnectionWrapper. In this way, the code for loading the DW does not have to care about which parameter format is used. This ConnectionWrapper is a special one for JDBC in Jython.

Create a ConnectionWrapper around the given JDBC connection.

If no default ConnectionWrapper already exists, the new ConnectionWrapper is set to be the default ConnectionWrapper.

Arguments:

  • jdbcconn: An open JDBC Connection (not a PEP249 Connection)

  • stmtcachesize: The maximum number of PreparedStatements kept open. Default: 20.

close()

Close the connection to the database,

commit()

Commit the transaction.

cursor()

Not implemented for this JDBC connection wrapper!

execute(stmt, arguments=None, namemapping=None, ignored=None)

Execute a statement.

Arguments:

  • stmt: the statement to execute

  • arguments: a mapping with the arguments. Default: None.

  • namemapping: a mapping of names such that if stmt uses %(arg)s and namemapping[arg]=arg2, the value arguments[arg2] is used instead of arguments[arg]

  • ignored: An ignored argument only present to accept the same number of arguments as ConnectionWrapper.execute

executemany(stmt, params, ignored=None)

Execute a sequence of statements.

Arguments:

  • stmt: the statement to execute

  • params: a sequence of arguments

  • ignored: An ignored argument only present to accept the same number of arguments as ConnectionWrapper.executemany

fetchalltuples()

Return all result tuples

fetchmanytuples(cnt)

Return cnt result tuples.

fetchone(names=None)

Return one result row (i.e. dict).

fetchonetuple()

Return one result tuple.

getunderlyingmodule()

Return a reference to the underlying connection’s module.

resultnames()
rollback()

Rollback the transaction.

rowcount()

Not implemented. Return 0. Should return the size of the result.

rowfactory(names=None)

Return a generator object returning result rows (i.e. dicts).

setasdefault()

Set this ConnectionWrapper as the default connection.