BulkCursor Object Constructor

Python extension module that provides a connection object to establish a connection to the database. The connection object includes a method for creating a new BulkCursor object, which manages the context of a bulk operation.

The BulkCursor object can be constructed only from a connection object that was established with a property marking the connection for use in a bulk operation.

Usage

import sybpydb
conn = sybpydb.connect(dsn="user=sa;bulk=true")cur = conn.cursor()
cur.execute("create table mytable (i int, c char(10))")
blk = conn.blkcursor()

close()

The close() method of the BulkCursor object closes a bulk operation. Once this method has been called, the bulk cursor object cannot be used. close() takes no arguments.

Usage

import sybpydb
conn = sybpydb.connect(dsn="user=sa;bulk=true")
blk = conn.blkcursor()
bblk.close()

copy()

The copy() method of the BulkCursor object initializes a bulk operation.

This method accepts the following arguments:

  • tablename – a string specifying the name of the table for the bulk operation.

  • direction – this is a keyword argument with these values: in and out.

Usage

import sybpydb
conn = sybpydb.connect(dsn="user=sa;bulk=true")
cur = conn.cursor()
cur.execute("create table mytable (i int, c char(10))")
blk = conn.blkcursor()
blk.copy("mytable", direction="out")

done()

The done() method of the BulkCursor object marks the completion of a bulk operation. To start another operation, call the copy() method.

Usage

import sybpydb
conn = sybpydb.connect(dsn="user=sa;bulk=true")
cur = conn.cursor()
cur.execute("create table mytable (i int, c char(10)
blk = conn.blkcursor()
blk.copy("mytable", direction="in")
...
blk.done()
blk.copy("mytable", direction="out")
...
blk.done()
blk.close()