[DB-SIG] Sybase module 0.28 (Brown Paper Bag) released

Dave Cole djc@object-craft.com.au
27 Jun 2001 13:05:27 +1000


What is it:

The Sybase module provides a Python interface to the Sybase relational
database system. The Sybase package supports almost all of the Python
Database API, version 2.0 with extensions.

The module works with Python versions 1.5.2 and later and Sybase
versions 11.0.3 and later.  It is based on the Sybase Client Library
(ct_* API), and the Bulk-Library Client (blk_* API) interfaces.

The 0.20 and later releases are a re-implementation of the module using
a thin C wrapper on the Sybase-CT API, and a Python module to provide
the DB-API functionality.  It is still a work in progress, but should
be good enough for most purposes.

Changes for this release:

After shooting my mouth off about the cool things that you can do with
bulkcopy I went back and tested my claims.  I found that I had not
implemented support for the bulkcopy optional argument to
Sybase.connect()...

Changes for this release:

- The following claim I made earlier today on comp.lang.python is now
  true:

  If your source data is CSV format then you can use another one of the
  modules I wrote to load it into a format suitable to feeding the
  bulkcopy object in the Sybase module.  The module was written
  specifically to handle data type data produced by Access and Excel.
  
          http://www.object-craft.com.au/projects/csv/
  
  >>> import Sybase, csv
  >>>
  >>> db = Sybase.connect('SYBASE', 'user', 'password', bulkcopy = 1, auto_commit = 1)
  >>> db.execute('create table #bogus (name varchar(40), num int)')
  >>> 
  >>> p = csv.parser()
  >>> bcp = db.bulkcopy('#bogus')
  >>> for line in open('datafile').readlines():
  >>>     fields = p.parse(line)
  >>>     if fields:
  >>>         bcp.rowxfer(line)
  >>> print 'Loaded', bcp.done(), 'rows'

- Documentation updates.

- Dave

P.S.  Hopefully there will be a period of more than one day before the
      next release...

-- 
http://www.object-craft.com.au