From samuel.j.young at gmail.com Mon Feb 19 07:38:33 2007 From: samuel.j.young at gmail.com (Sam Young) Date: Mon, 19 Feb 2007 01:38:33 -0500 Subject: [Z3-sqlos] sqlos and mysqldbda Message-ID: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> Hi, New to the list, but I'm having a little bit of trouble with sqlos and mysqldbda. My SQLObject subclass is working perfectly with MySQLdb, and entering queries for mysqldbda manually through ZMI works just fine. At one point, I had the sqlos-0.3.0 sampleapp running on a fresh Zope-3.3.1 instance. Now, when I try to integrate my app (simple object, simple container) I'm getting the following after adding a new container in ZMI. When I try to get the sampleapp working again, I get a similar error during table creation. If I'm not mistaken, the check for need_unicode is part of SQLObject. The "self" in self.need_unicode is seemingly being called on MySQLAdapter in sqlos, causing the error. Has anyone seen this before? I'm glad to provide more information from configuration or the classes themselves. I hear PostgreSQL is easier to integrate with sqlos, but I'm not sure that will be an option in my case. Thank you kindly in advance, Sam Traceback (most recent call last): Module zope.publisher.publish, line 133, in publish result = publication.callObject(request, obj) Module zope.app.publication.zopepublication, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) Module zope.publisher.publish, line 108, in mapply return debug_call(obj, args) - __traceback_info__: > Module zope.publisher.publish, line 114, in debug_call return obj(*args) Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__ return self.im_func(im_self, *args, **kw) Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__ sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0), Module zope.pagetemplate.pagetemplate, line 117, in pt_render strictinsert=0, sourceAnnotations=sourceAnnotations)() Module zope.tal.talinterpreter, line 271, in __call__ self.interpret(self.program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 891, in do_useMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 536, in do_optTag_tal self.do_optTag(stuff) Module zope.tal.talinterpreter, line 521, in do_optTag return self.no_tag(start, program) Module zope.tal.talinterpreter, line 516, in no_tag self.interpret(program) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 861, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 957, in do_defineSlot self.interpret(block) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 949, in do_defineSlot self.interpret(slot) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 861, in do_defineMacro self.interpret(macro) Module zope.tal.talinterpreter, line 346, in interpret handlers[opcode](self, args) Module zope.tal.talinterpreter, line 586, in do_setLocal_tal self.engine.setLocal(name, self.engine.evaluateValue(expr)) Module zope.tales.tales, line 696, in evaluate return expression(self) - /home/sam/Zope-3.3.1/src/zope/app/container/browser/contents.pt - Line 7, Column 4 - Expression: - Names: {'args': (), 'context': , 'default': , 'loop': {}, 'nothing': None, 'options': {}, 'repeat': {}, 'request': , 'template': , 'usage': , 'view': , 'views': } Module zope.tales.expressions, line 217, in __call__ return self._eval(econtext) Module zope.tales.expressions, line 211, in _eval return ob() Module zope.app.container.browser.contents, line 80, in listContentInfo self.addObject() Module zope.app.container.browser.contents, line 245, in addObject adding.action(request['type_name'], new) Module zope.app.container.browser.adding, line 152, in action self.add(content) Module zope.app.container.browser.adding, line 72, in add container[name] = content Module zope.app.folder.folder, line 94, in __setitem__ setitem(self, self.data.__setitem__, name, object) Module zope.app.container.contained, line 593, in setitem notify(event) Module zope.event, line 23, in notify subscriber(event) Module zope.component.event, line 26, in dispatch for ignored in zope.component.subscribers(event, None): Module zope.component._api, line 130, in subscribers Module zope.component.registry, line 290, in subscribers Module zope.interface.adapter, line 535, in subscribers subscription(*objects) Module zope.component.event, line 33, in objectEventNotify adapters = zope.component.subscribers((event.object, event), None) Module zope.component._api, line 130, in subscribers Module zope.component.registry, line 290, in subscribers Module zope.interface.adapter, line 535, in subscribers subscription(*objects) Module zope.app.container.contained, line 181, in dispatchToSublocations for sub in subs.sublocations(): Module zope.app.container.contained, line 212, in sublocations for key in container: Module sqlos.container, line 103, in keys for name, obj in self.items(): yield name Module sqlos.container, line 119, in items for obj in utility.select(): Module sqlobject.sresults, line 155, in __iter__ return iter(list(self.lazyIter())) Module sqlobject.sresults, line 163, in lazyIter return conn.iterSelect(self) Module sqlobject.dbconnection, line 365, in iterSelect select, keepConnection=False) Module sqlobject.dbconnection, line 706, in __init__ self.dbconn._executeRetry(self.rawconn, self.cursor, self.query) Module sqlos.adapter, line 124, in _executeRetry raise DatabaseException(str(exc.args)) DatabaseException: ("'MySQLAdapter' object has no attribute 'need_unicode'",) From kobold at kobold.it Mon Feb 19 08:29:04 2007 From: kobold at kobold.it (Fabio Tranchitella) Date: Mon, 19 Feb 2007 08:29:04 +0100 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> Message-ID: <20070219072904.GA23848@ulisse.dmgroup.hu> * 2007-02-19 07:39, Sam Young wrote: > Hi, Hi! > Now, when I try to integrate my app (simple object, simple container) > I'm getting the following after adding a new container in ZMI. When I > try to get the sampleapp working again, I get a similar error during > table creation. If I'm not mistaken, the check for need_unicode is > part of SQLObject. The "self" in self.need_unicode is seemingly being > called on MySQLAdapter in sqlos, causing the error. MySQLAdapter shouldn't be used directly by SQLObject objects, but instead they should use a ConnectionDescriptor descriptor which will map those attribute look-ups to the inner object, the mysqldbda instance. > Has anyone seen this before? I'm glad to provide more information from > configuration or the classes themselves. If you could isolate your problem in a sample application, then I could debug it locally to understand where the problem is. I remember that I had the very same error sometime ago and it was a configuration error, but I do not remember what was wrong exactly. > I hear PostgreSQL is easier to integrate with sqlos, but I'm not sure > that will be an option in my case. I think sqlos is quite database agnostic, it is just that usually the postgresql integration is more tested than the MySQL one. Thanks, -- Fabio Tranchitella http://www.kobold.it Free Software Developer and Consultant http://www.tranchitella.it _____________________________________________________________________ 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 From samuel.j.young at gmail.com Mon Feb 19 16:14:40 2007 From: samuel.j.young at gmail.com (Sam Young) Date: Mon, 19 Feb 2007 10:14:40 -0500 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <20070219072904.GA23848@ulisse.dmgroup.hu> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> Message-ID: <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> Thanks for the response. I've tried to isolate the problem using the following configuration. I've made sure everything installs correctly and is in the Python path. 1) Fresh Zope from svn (tried both 3.3.0 and 3.3.1 release tags) 2) easy_install MySQL-python-1.2.1 (also tried the default/newer 1.2.2b3) 3) easy_install SQLObject-0.7.3 (also tried the default/newer 0.8.0b3) 4) easy_install sqlos-0.3.0 5) svn co http://svn.zope.org/repos/main/mysqldbda mysqldbda 6) copy sqlos/includes to etc/package-includes (also using sampleapp zcml) 7) switch the sqlos sampleapp configuration to use mysql instead of sqlite Again, I've been able to use SQLOS subclasses to test writes/retrievals with the python shell and doctests. The mysqdbda adapter also works manually--I can enter queries by hand through ZMI. There was a point at which I was able to run the sample app, but now Zope fails to start. I created the tables manually to see if that would help, but I don't think this setup is able to execute any queries whatsoever. The traceback from the last email was with my custom application. The error did not occur until I tried to create my container. When I run Zope with the sample, the following happens and Zope does not start: Traceback (most recent call last): File "/home/sam/testzope/bin/debugzope", line 45, in ? db = startup() File "/home/sam/testzope/bin/debugzope", line 38, in startup db = debug(["-C", CONFIG_FILE] + sys.argv[1:]) File "/home/sam/Zope-3.3.1/src/zope/app/twisted/main.py", line 103, in debug notify(zope.app.appsetup.interfaces.DatabaseOpened(db)) File "/home/sam/Zope-3.3.1/src/zope/event/__init__.py", line 23, in notify subscriber(event) File "/home/sam/Zope-3.3.1/src/zope/component/event.py", line 26, in dispatch for ignored in zope.component.subscribers(event, None): File "/home/sam/Zope-3.3.1/src/zope/component/_api.py", line 130, in subscribers return sitemanager.subscribers(objects, interface) File "/home/sam/Zope-3.3.1/src/zope/component/registry.py", line 290, in subscribers return self.adapters.subscribers(objects, provided) File "/home/sam/Zope-3.3.1/src/zope/interface/adapter.py", line 535, in subscribers subscription(*objects) File "/home/sam/testzope/lib/python/sqlos-0.3.0-py2.4.egg/sqlos/testing/sampleperson.py", line 14, in createTestingTablesSubscriber createTestingTables() File "/home/sam/testzope/lib/python/sqlos-0.3.0-py2.4.egg/sqlos/testing/sampleperson.py", line 20, in createTestingTables if table._connection.tableExists(table.sqlmeta.table): File "/home/sam/testzope/lib/python/SQLObject-0.8.0-py2.4.egg/sqlobject/mysql/mysqlconnection.py", line 182, in tableExists self.query('DESCRIBE %s' % (tableName)) File "/home/sam/testzope/lib/python/SQLObject-0.8.0-py2.4.egg/sqlobject/dbconnection.py", line 316, in query return self._runWithConnection(self._query, s) File "/home/sam/testzope/lib/python/sqlos-0.3.0-py2.4.egg/sqlos/adapter.py", line 83, in _runWithConnection val = meth(conn, *args) File "/home/sam/testzope/lib/python/SQLObject-0.8.0-py2.4.egg/sqlobject/dbconnection.py", line 313, in _query self._executeRetry(conn, conn.cursor(), s) File "/home/sam/testzope/lib/python/sqlos-0.3.0-py2.4.egg/sqlos/adapter.py", line 124, in _executeRetry raise DatabaseException(str(exc.args)) zope.rdb.interfaces.DatabaseException: ("'MySQLAdapter' object has no attribute 'need_unicode'",) On 2/19/07, Fabio Tranchitella wrote: > * 2007-02-19 07:39, Sam Young wrote: > > Hi, > > Hi! > > > Now, when I try to integrate my app (simple object, simple container) > > I'm getting the following after adding a new container in ZMI. When I > > try to get the sampleapp working again, I get a similar error during > > table creation. If I'm not mistaken, the check for need_unicode is > > part of SQLObject. The "self" in self.need_unicode is seemingly being > > called on MySQLAdapter in sqlos, causing the error. > > MySQLAdapter shouldn't be used directly by SQLObject objects, but instead > they should use a ConnectionDescriptor descriptor which will map those > attribute look-ups to the inner object, the mysqldbda instance. > > > Has anyone seen this before? I'm glad to provide more information from > > configuration or the classes themselves. > > If you could isolate your problem in a sample application, then I could > debug it locally to understand where the problem is. I remember that > I had the very same error sometime ago and it was a configuration error, > but I do not remember what was wrong exactly. > > > I hear PostgreSQL is easier to integrate with sqlos, but I'm not sure > > that will be an option in my case. > > I think sqlos is quite database agnostic, it is just that usually the > postgresql integration is more tested than the MySQL one. > > Thanks, > > -- > Fabio Tranchitella http://www.kobold.it > Free Software Developer and Consultant http://www.tranchitella.it > _____________________________________________________________________ > 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 > From kobold at kobold.it Mon Feb 19 16:24:35 2007 From: kobold at kobold.it (Fabio Tranchitella) Date: Mon, 19 Feb 2007 16:24:35 +0100 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> Message-ID: <20070219152435.GF30570@ulisse.dmgroup.hu> * 2007-02-19 16:15, Sam Young wrote: > Thanks for the response. > > ... > > There was a point at which I was able to run the sample app, but now > Zope fails to start. I created the tables manually to see if that > would help, but I don't think this setup is able to execute any > queries whatsoever. The traceback from the last email was with my > custom application. The error did not occur until I tried to create my > container. I'm going to try your setup locally on my machine. I'll be back soon with a report and, if needed, a bug fix. :) Cheers, -- Fabio Tranchitella http://www.kobold.it Free Software Developer and Consultant http://www.tranchitella.it _____________________________________________________________________ 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 From samuel.j.young at gmail.com Mon Feb 19 20:25:31 2007 From: samuel.j.young at gmail.com (Sam Young) Date: Mon, 19 Feb 2007 14:25:31 -0500 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <20070219152435.GF30570@ulisse.dmgroup.hu> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> <20070219152435.GF30570@ulisse.dmgroup.hu> Message-ID: <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> Thank you! If it is a zcml configuration problem in the sampleapp as opposed to a bug, then it is almost a given that my app configuration has the same problem. Being new at this, I've been looking at the included sampleapp and the functional testing package in the sqlos trunk. Best, Sam On 2/19/07, Fabio Tranchitella wrote: > * 2007-02-19 16:15, Sam Young wrote: > > Thanks for the response. > > > > ... > > > > There was a point at which I was able to run the sample app, but now > > Zope fails to start. I created the tables manually to see if that > > would help, but I don't think this setup is able to execute any > > queries whatsoever. The traceback from the last email was with my > > custom application. The error did not occur until I tried to create my > > container. > > I'm going to try your setup locally on my machine. > > I'll be back soon with a report and, if needed, a bug fix. :) > > Cheers, > > -- > Fabio Tranchitella http://www.kobold.it > Free Software Developer and Consultant http://www.tranchitella.it > _____________________________________________________________________ > 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 > From kobold at kobold.it Mon Feb 19 21:17:13 2007 From: kobold at kobold.it (Fabio Tranchitella) Date: Mon, 19 Feb 2007 21:17:13 +0100 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> <20070219152435.GF30570@ulisse.dmgroup.hu> <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> Message-ID: <20070219201713.GA26604@ulisse.dmgroup.hu> * 2007-02-19 20:26, Sam Young wrote: > Thank you! > > If it is a zcml configuration problem in the sampleapp as opposed to a > bug, then it is almost a given that my app configuration has the same > problem. Being new at this, I've been looking at the included > sampleapp and the functional testing package in the sqlos trunk. Sorry, does it mean that it is already fixed in the trunk or that the bug is present only in the trunk? Thanks, -- Fabio Tranchitella http://www.kobold.it Free Software Developer and Consultant http://www.tranchitella.it _____________________________________________________________________ 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 From samuel.j.young at gmail.com Mon Feb 19 21:21:53 2007 From: samuel.j.young at gmail.com (Sam Young) Date: Mon, 19 Feb 2007 15:21:53 -0500 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <20070219201713.GA26604@ulisse.dmgroup.hu> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> <20070219152435.GF30570@ulisse.dmgroup.hu> <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> <20070219201713.GA26604@ulisse.dmgroup.hu> Message-ID: <1b256c740702191221j4a647b2ckf569da65d5b64a18@mail.gmail.com> Sorry. I have not used the code in the trunk at http://codespeak.net/svn/z3/sqlos/. I meant only that I am basing my configuration off of those of the sampleapp in 0.3.0 and the sampleapp in the trunk. If there happens to be a misconfiguration in either sampleapp, I have probably made the same mistake. But I have not used the trunk code yet. On 2/19/07, Fabio Tranchitella wrote: > * 2007-02-19 20:26, Sam Young wrote: > > Thank you! > > > > If it is a zcml configuration problem in the sampleapp as opposed to a > > bug, then it is almost a given that my app configuration has the same > > problem. Being new at this, I've been looking at the included > > sampleapp and the functional testing package in the sqlos trunk. > > Sorry, does it mean that it is already fixed in the trunk or that the bug > is present only in the trunk? > > Thanks, > > -- > Fabio Tranchitella http://www.kobold.it > Free Software Developer and Consultant http://www.tranchitella.it > _____________________________________________________________________ > 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 > From samuel.j.young at gmail.com Tue Feb 20 01:56:17 2007 From: samuel.j.young at gmail.com (Sam Young) Date: Mon, 19 Feb 2007 19:56:17 -0500 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <1b256c740702191221j4a647b2ckf569da65d5b64a18@mail.gmail.com> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> <20070219152435.GF30570@ulisse.dmgroup.hu> <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> <20070219201713.GA26604@ulisse.dmgroup.hu> <1b256c740702191221j4a647b2ckf569da65d5b64a18@mail.gmail.com> Message-ID: <1b256c740702191656i634f53a5lcf53662938763f0b@mail.gmail.com> Update: I have used the code in the trunk now. It has the same affect. There definitely appears to be some issue with sqlos.adapter.MySQLAdapter._executeRetry calling sqlobject.mysql._executeRetry. I think that a MySQLAdapter instance is getting passed in *args, thus self does not refer to a DBConnection/DBAPI/MySQLConnection instance, which has the property need_unicode. I *think* this is what's happening. I'm not sure what configuration might affect this, or if it is a bug. Strange that this worked before. I'm not sure what changed. I'm definitely not sure how to fix it :) Thank you once again for your help. Best, Sam On 2/19/07, Sam Young wrote: > Sorry. I have not used the code in the trunk at > http://codespeak.net/svn/z3/sqlos/. I meant only that I am basing my > configuration off of those of the sampleapp in 0.3.0 and the sampleapp > in the trunk. If there happens to be a misconfiguration in either > sampleapp, I have probably made the same mistake. But I have not used > the trunk code yet. > > > > On 2/19/07, Fabio Tranchitella wrote: > > * 2007-02-19 20:26, Sam Young wrote: > > > Thank you! > > > > > > If it is a zcml configuration problem in the sampleapp as opposed to a > > > bug, then it is almost a given that my app configuration has the same > > > problem. Being new at this, I've been looking at the included > > > sampleapp and the functional testing package in the sqlos trunk. > > > > Sorry, does it mean that it is already fixed in the trunk or that the bug > > is present only in the trunk? > > > > Thanks, > > > > -- > > Fabio Tranchitella http://www.kobold.it > > Free Software Developer and Consultant http://www.tranchitella.it > > _____________________________________________________________________ > > 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564 > > > From kobold at kobold.it Tue Feb 20 08:33:06 2007 From: kobold at kobold.it (Fabio Tranchitella) Date: Tue, 20 Feb 2007 08:33:06 +0100 Subject: [Z3-sqlos] sqlos and mysqldbda In-Reply-To: <1b256c740702191656i634f53a5lcf53662938763f0b@mail.gmail.com> References: <1b256c740702182238n77168533sf2b4688db5fab8ed@mail.gmail.com> <20070219072904.GA23848@ulisse.dmgroup.hu> <1b256c740702190714l4ac53ddbx4cdf5fbcefdcede6@mail.gmail.com> <20070219152435.GF30570@ulisse.dmgroup.hu> <1b256c740702191125u7e53e67cyb2b15676e0b2b869@mail.gmail.com> <20070219201713.GA26604@ulisse.dmgroup.hu> <1b256c740702191221j4a647b2ckf569da65d5b64a18@mail.gmail.com> <1b256c740702191656i634f53a5lcf53662938763f0b@mail.gmail.com> Message-ID: <20070220073306.GC14494@ulisse.dmgroup.hu> * 2007-02-20 01:57, Sam Young wrote: > Update: I have used the code in the trunk now. It has the same affect. > > There definitely appears to be some issue with > sqlos.adapter.MySQLAdapter._executeRetry calling > sqlobject.mysql._executeRetry. I think that a MySQLAdapter instance is > getting passed in *args, thus self does not refer to a > DBConnection/DBAPI/MySQLConnection instance, which has the property > need_unicode. Fine, I'm trying this locally: let's see if I can reproduce it. Cheers, -- Fabio Tranchitella http://www.kobold.it Free Software Developer and Consultant http://www.tranchitella.it _____________________________________________________________________ 1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564