On Fri, 30 May 2003 10:56:59 +0200
"Bud P. Bruegger" <bu...@si...> wrote:
> So what do you think of a PickleCol?
As a followup, this is how I implemented PickleCol in my own code
(where it becomes a attribute that sits above columns):
class PickleAttr(Attr):
"provides a shortcut constructor for most common use case of Attr"
def __init__(self, name, dbName=None, classMap=None):
dbN = dbName or name
dbCol = DbCol(dbN, 'blob')
toSql = lambda x: [pickle.dumps(x, bin)]
fromSql = lambda x: pickle.loads(x[0])
Attr.__init__(self, name, dbCol, \
fromSql=fromSql, \
toSql = toSql, \
classMap=classMap)
So quite simple and straight forward....
BTW, the PsycopgDbDriver overrides the generic DbDrivers method
nonStandardTypes such that it can translate 'blob' to 'bytea'...
|