[Z3-sqlos] sqlos and mysqldbda

Sam Young samuel.j.young at gmail.com
Mon Feb 19 16:14:40 CET 2007


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 <kobold at kobold.it> 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
>


More information about the z3-sqlos mailing list