[DB-SIG] About LOB
mal at egenix.com
Mon May 2 13:39:27 CEST 2011
Kwon, Chan Young wrote:
> Let me describe more...
> 1. My suggestion of LOB object is kind of Locator object. It does not contain whole massive data. It just passes small piece of data when its methods are called.
> 2. buffer object is not enough to handle various kinds of LOB types. For example, character LOB, binary LOB and unicode character LOB.
> In my company, this LOB class is already used as extension of DBAPI spec 2.0.
> All colleagues like LOB class because it is very simple and easy to use.
> So I sent this for your information.
There are various ways large binary/text objects are handled by
databases at the API level.
Some databases provide APIs which allow reading/writing such
data in chunks, others provide file descriptors which can be use
used for this, yet others maintain the files outside the database
and provide "locator" objects for these.
Since all of these approaches use a file-like interface in one
way or another, perhaps we could agree on a common DB-API extension
that defines the minimum interface of such objects and a constructor
that turns an existing file into an object which can then be passed
to the database (much like the Binary() constructor we have for
Do you have documentation for the LOB object you are using available
on the web ?
Professional Python Services directly from the Source (#1, May 02 2011)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2011-06-20: EuroPython 2011, Florence, Italy 49 days to go
::: Try our new mxODBC.Connect Python Database Interface for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
> Best wishes,
> Chanyoung Kwon
> SAP R&D Center Korea
> -----Original Message-----
> From: Chris Clark [mailto:Chris.Clark at ingres.com]
> Sent: Thursday, April 28, 2011 2:05 AM
> To: Kwon, Chan Young
> Cc: db-sig at python.org
> Subject: Re: [DB-SIG] About LOB
> Kwon, Chan Young wrote:
>> I am implementing new DB API for new Database according to DB API 2.0. (as C-Extension)
>> There is no specification about LOB in DB API 2.0
>> Especially, I need LOB object for piecewise LOB writing/reading after query execution.
>> So I defined my own LOB object.
>> I tried to make simple and easy interface for LOB.
> BLarge OBject's (BLOBs) are alluded to in pep 249 BUT they really are
> not detailed so I think you have spotted a weakness in the spec. CLOBs
> (Character Large OBjects) are not covered at all. Locators are not
> discussed but implied by references to bufferobjects.
> For BLOBs as input bind parameters check out the Binary() constructor
> (case sensitive) at http://www.python.org/dev/peps/pep-0249/.
> For BLOB results look for bufferobject in
> The spec (as I read it) really expects LOBs to be handled as one massive
> block. However implementators can choose to implement locators behind
> the scene so that data isn't sent across the wire unless the buffer
> object is read from.
> So, model your LOB access methods on bufferobjects and you should be all
> set! Marc-Andre reads/responds to the list regularly so take note of any
> suggestions he has :-)
> Hope that helps get you started.
> DB-SIG maillist - DB-SIG at python.org
More information about the DB-SIG