[TransWarp] SqliteURL returns FileFactory?

John Landahl john at landahl.org
Mon Aug 11 16:33:28 EDT 2003


Hello, all.  A while back (a month ago?) I had some DMs working with both 
Postgres and Sqlite.  Now that I need to actually use the DMs it seems that 
the changes made around July 16th having to do with adaptTo/defaultFactory
may have broken Sqlite-based URL functionality.  Either that or I just don't 
understand how a database object should be constructed now.  Unfortunately 
the Bulletins example hasn't been updated yet to work correctly since the 
changes,  so there's no help there ('bulletins createdb' is now broken, for 
example).

Here's how I'm trying to create a database object:

  db = binding.Once(
    lambda self, d, a: self.lookupComponent('sqlite:foo.db')
  )

When I try to use it similarly to the Bulletins example, like so:

    ct, = ~self.db('SELECT MAX(host_id) FROM hosts')

I get the following exception: TypeError: 'FileFactory' object is not callable

So it seems the URL 'sqlite:foo.bar' results in a FileFactory object (just 
verified this with N2) -- shouldn't it be a SqliteConnection object?

Out of curiosity I just tried to lookup a "pgsql:" URL in N2 and got an 
AttributeError: 'GenericSQL_URL object has no attribute 'defaultFactory'

Is this a bug, or am I missing something?

John Landahl  (_jpl_ on IRC)
john at landahl.org



More information about the PEAK mailing list