Top Description Fields Constructors Methods
com.ziclix.python.sql.pipe.db

public Class DBSink

extends BaseDB
implements Sink
Class Inheritance
All Implemented Interfaces
com.ziclix.python.sql.pipe.Sink
Imports
com.ziclix.python.sql.PyConnection, .zxJDBC, com.ziclix.python.sql.pipe.Sink, org.python.core.Py, .PyDictionary, .PyList, .PyObject, .PyString, java.util.HashSet, .Set

A database consumer. All data transferred will be inserted into the appropriate table.
Author
brian zimmer

Field Summary

Modifier and TypeField and Description
protected int
batchsize

Field batchsize

protected PyObject
bindings

Field bindings

protected Set<E>
exclude

Field exclude

protected PyDictionary
indexedBindings

Field indexedBindings

protected PyList
rows

Field rows

protected PyObject
sql

Field sql

Inherited from com.ziclix.python.sql.pipe.db.BaseDB:
connectioncursordataHandlertableName

Constructor Summary

AccessConstructor and Description
public
DBSink(PyConnection
the database connection
connection
,
Class<T>
a custom DataHandler for the cursor, can be None
dataHandler
,
String
the table to insert the data
tableName
,
PyObject
the columns to be excluded from insertion on the destination, all if None
exclude
,
PyObject
the optional bindings for the destination, this allows morphing of types during the copy
bindings
,
int
the optional batchsize for the inserts
batchsize
)

Constructor for handling the consumption of data.

Method Summary

Modifier and TypeMethod and Description
protected void
createSql(PyObject row)

Create the insert statement given the header row.

public void
end()

Implements com.ziclix.python.sql.pipe.Sink.end.

Handles flushing any buffers and closes the cursor.

protected boolean
excluded(PyObject key)

Return true if the key (converted to lowercase) is not found in the exclude list.

public void
row(PyObject row)

Implements com.ziclix.python.sql.pipe.Sink.row.

Handle the row.

public void
start()

Implements com.ziclix.python.sql.pipe.Sink.start.

Method start

Inherited from com.ziclix.python.sql.pipe.db.BaseDB:
cursor

Field Detail

batchsizeback to summary
protected int batchsize

Field batchsize

bindingsback to summary
protected PyObject bindings

Field bindings

excludeback to summary
protected Set<E> exclude

Field exclude

indexedBindingsback to summary
protected PyDictionary indexedBindings

Field indexedBindings

rowsback to summary
protected PyList rows

Field rows

sqlback to summary
protected PyObject sql

Field sql

Constructor Detail

DBSinkback to summary
public DBSink(PyConnection connection, Class<T> dataHandler, String tableName, PyObject exclude, PyObject bindings, int batchsize)

Constructor for handling the consumption of data.

Parameters
connection:PyConnection

the database connection

dataHandler:Class<T>

a custom DataHandler for the cursor, can be None

tableName:String

the table to insert the data

exclude:PyObject

the columns to be excluded from insertion on the destination, all if None

bindings:PyObject

the optional bindings for the destination, this allows morphing of types during the copy

batchsize:int

the optional batchsize for the inserts

Method Detail

createSqlback to summary
protected void createSql(PyObject row)

Create the insert statement given the header row.

endback to summary
public void end()

Implements com.ziclix.python.sql.pipe.Sink.end.

Handles flushing any buffers and closes the cursor.

excludedback to summary
protected boolean excluded(PyObject key)

Return true if the key (converted to lowercase) is not found in the exclude list.

rowback to summary
public void row(PyObject row)

Implements com.ziclix.python.sql.pipe.Sink.row.

Handle the row. Insert the data into the correct table and columns. No updates are done.

startback to summary
public void start()

Implements com.ziclix.python.sql.pipe.Sink.start.

Method start