Hello,

I'm trying inheritance but have a few problems with it.
One is I can not do an orderBy on an inherited column : bug or feature?
Here is the code, output and config :

------------------------------------------------------------------------------
import sys
sys.path.insert(0, 'lib/FormEncode-0.4-py2.4.egg')
sys.path.insert(0, 'lib/SQLObject-0.7.0-py2.4.egg')
import sqlobject as so
import sqlobject.inheritance

so.sqlhub.processConnection = so.connectionForURI('sqlite:/:memory:')

class Entity(so.inheritance.InheritableSQLObject):
        name = so.UnicodeCol(notNone=1)
class Country(Entity):
        code = so.StringCol(length=2) # iso3166-1 Alpha-2

Entity.createTable(ifNotExists=True)
Country.createTable(ifNotExists=True)

Country(name='Switzerland', code='CH')
Country(name='South Africa', code='ZA')

print list(Country.select(orderBy='code'))
print list(Country.select(orderBy='name'))
------------------------------------------------------------------------------
[<Country 1 code='CH' name=u'Switzerland'>, <Country 2 code='ZA'
name=u'South Africa'>]
Traceback (most recent call last):
  File "inh.py", line 21, in ?
    print list(Country.select(orderBy='name'))
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\sresults.py", line
149, in __iter__
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\sresults.py", line
157, in lazyIter
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py", line
361, in iterSelect
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\inheritance\iteration.py",
line 10, in __init__
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py", line
687, in __init__
  File "lib\SQLObject-0.7.0-py2.4.egg\sqlobject\dbconnection.py", line
295, in _executeRetry
pysqlite2.dbapi2.OperationalError: no such column: name
------------------------------------------------------------------------------

config: win32, python-2.4, pysqlite-2.0.6

--
jt

Reply via email to