So, I had a class that had an internal _connection. When I tried to pickle it,
I got errors, which from the looks of main were related to whether I had a per
instance connection or went through sqlhub. So I rewrote the class & code as
follows:
connection =
connectionForURI('mysql://%s:%...@%s:3306/%s?debug=1&use_unicode=1&charset=utf8'
% (dbuser,dbpass,dbhost,dbname))
sqlhub.processConnection = connection
class Title(SQLObject):
class sqlmeta:
fromDatabase = True
books = MultipleJoin('Book')
author = RelatedJoin('Author',
intermediateTable='author_title',createRelatedTable=True)
categorys = MultipleJoin('Category')
kind = ForeignKey('Kind')
listTheseKeys=('kind')
but I'm still getting the same PicklingError. What can I be missing? I've seen
a few recent posts about fixing this, but is there a workaround?
Thank much
--Marko
/Users/mkapes/Downloads/infoshopkeeper/AmazonAuthorTitle.py in <module>()
40 except KeyError:
41 ourTitles=list(Title.select(RLIKE(Title.q.isbn,
'^[0-9]{9}[0-9xX]{1}$') & (Title.q.kindID==1)))
---> 42 shelf['ourTitles']=ourTitles
43
44
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shelve.pyc
in __setitem__(self, key, value)
130 f = StringIO()
131 p = Pickler(f, self._protocol)
--> 132 p.dump(value)
133 self.dict[key] = f.getvalue()
134
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/SQLObject-0.13dev_r4106-py2.6.egg/sqlobject/main.pyc
in __getstate__(self)
1679 if self.sqlmeta._perConnection:
1680 from pickle import PicklingError
-> 1681 raise PicklingError('Cannot pickle an SQLObject instance
that has a per-instance connection')
1682 d = self.__dict__.copy()
1683 del d['sqlmeta']
PicklingError: Cannot pickle an SQLObject instance that has a per-instance
connection
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/SQLObject-0.13dev_r4106-py2.6.egg/sqlobject/main.py(1681)__getstate__()
1680 from pickle import PicklingError
-> 1681 raise PicklingError('Cannot pickle an SQLObject instance
that has a per-instance connection')
1682 d = self.__dict__.copy()
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss