Ya the error changed, now I get a different one (probably oracle specific) see
atachment.
Quoting Michael Bayer <[EMAIL PROTECTED]>:
> this works with SQLite and should be working with Oracle as I
> repaired that bug.
>
> On Mar 21, 2006, at 7:45 AM, Florian Boesch wrote:
>
> > Testing a previous bug I noticed that somemapper.get_by and
> > inheritance stopped
> > working (this refers to the trackeback from inheritance in 1117).
> >
> > A test programm reproducing the error is atached.
> >
> > Cheers,
> > Florian
> > <get_by and inheritance.py>
>
>
from sqlalchemy import *
engine = create_engine('oracle://dsn=orcl&user=test&password=test')
foo = Table('foo', engine, Column('id', Integer, Sequence('foo_seq'),
primary_key=True))
bar = Table('bar', engine, Column('id', Integer, ForeignKey('foo.id'),
primary_key=True))
class Foo(object): pass
class Bar(object): pass
foos = mapper(Foo, foo)
bars = mapper(Bar, bar, inherits=foos)
tables = foo, bar
for table in reversed(tables):
try: table.drop()
except: pass
for table in tables:
try: table.create()
except: pass
assert foos.selectfirst() == None
foo.insert().execute()
assert foos.selectfirst() != None
assert bars.selectfirst() == None # fails exception #1
assert bars.get_by(id=1) == None # fails exception #2
assert bars.selectfirst_by(id=1) == None # fails exception #3
bar.insert().execute(id=1)
assert bars.selectfirst() != None # fails exception #1
assert bars.get_by(id=1) != None # fails exception #2
assert bars.selectfirst_by(id=1) != None # fails exception #3
# exception #1
'''
Traceback (most recent call last):
File "selectfirst.py", line 22, in ?
assert bars.selectfirst() == None # fails exception #1
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 485, in selectfirst
ret = self.select(*args, **params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 511, in select
return self.select_whereclause(arg, **kwargs)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 515, in select_whereclause
return self._select_statement(statement, params=params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 535, in _select_statement
return self.instances(statement.execute(**params), **kwargs)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 436, in execute
return c.execute(*multiparams, **params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 330, in execute
return self.engine.execute_compiled(self, params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 643, in execute_compiled
proxy(str(compiled), parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 638, in proxy
self.execute(statement, parameters, connection=connection, cursor=cursor,
return_raw=True)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 689, in execute
self._execute(cursor, statement, parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 709, in _execute
raise exceptions.SQLError(statement, parameters, e)
sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-00904: "NONE"."ROWID":
invalid identifier
'SELECT bar_id, foo_id \nFROM (SELECT bar.id AS bar_id, foo.id AS foo_id,
ROW_NUMBER() OVER (ORDER BY None.rowid ASC) AS ora_rn \nFROM foo JOIN bar ON
foo.id = bar.id) \nWHERE ora_rn<=1' {}
'''
# exception #2
'''
Traceback (most recent call last):
File "selectfirst.py", line 23, in ?
assert bars.get_by(id=1) == None # fails exception #2
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 394, in get_by
x = self.select_whereclause(self._by_clause(*args, **params), limit=1)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 515, in select_whereclause
return self._select_statement(statement, params=params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 535, in _select_statement
return self.instances(statement.execute(**params), **kwargs)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 436, in execute
return c.execute(*multiparams, **params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 330, in execute
return self.engine.execute_compiled(self, params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 643, in execute_compiled
proxy(str(compiled), parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 638, in proxy
self.execute(statement, parameters, connection=connection, cursor=cursor,
return_raw=True)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 689, in execute
self._execute(cursor, statement, parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 709, in _execute
raise exceptions.SQLError(statement, parameters, e)
sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-00904: "NONE"."ROWID":
invalid identifier
'SELECT bar_id, foo_id \nFROM (SELECT bar.id AS bar_id, foo.id AS foo_id,
ROW_NUMBER() OVER (ORDER BY None.rowid ASC) AS ora_rn \nFROM foo JOIN bar ON
foo.id = bar.id \nWHERE bar.id = :bar_id) \nWHERE ora_rn<=1' {'bar_id': 1}
'''
# exception #3
'''
Traceback (most recent call last):
File "selectfirst.py", line 24, in ?
assert bars.selectfirst_by(id=1) == None # fails exception #3
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 418, in selectfirst_by
return self.get_by(*args, **params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 394, in get_by
x = self.select_whereclause(self._by_clause(*args, **params), limit=1)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 515, in select_whereclause
return self._select_statement(statement, params=params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/mapping/mapper.py",
line 535, in _select_statement
return self.instances(statement.execute(**params), **kwargs)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 436, in execute
return c.execute(*multiparams, **params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/sql.py",
line 330, in execute
return self.engine.execute_compiled(self, params)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 643, in execute_compiled
proxy(str(compiled), parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 638, in proxy
self.execute(statement, parameters, connection=connection, cursor=cursor,
return_raw=True)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 689, in execute
self._execute(cursor, statement, parameters)
File
"/usr/local/lib/python2.4/site-packages/SQLAlchemy-0.1.4-py2.4.egg/sqlalchemy/engine.py",
line 709, in _execute
raise exceptions.SQLError(statement, parameters, e)
sqlalchemy.exceptions.SQLError: (DatabaseError) ORA-00904: "NONE"."ROWID":
invalid identifier
'SELECT bar_id, foo_id \nFROM (SELECT bar.id AS bar_id, foo.id AS foo_id,
ROW_NUMBER() OVER (ORDER BY None.rowid ASC) AS ora_rn \nFROM foo JOIN bar ON
foo.id = bar.id \nWHERE bar.id = :bar_id) \nWHERE ora_rn<=1' {'bar_id': 1}
'''