get_by and inheritance

Issue #122 resolved
Former user created an issue

When using the get_by or get_by_something method of a mapper that inherits a base mapper, for a column that exists in the base-mapper an exception occurs:

line 286, in visit_select
    orderby = "%s.rowid ASC" % select.froms[0](0).name
AttributeError: 'JoinMarker' object has no attribute 'name'

Below a test-programm for the issue.

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),
    Column('something', String(255))
    )
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)

bars.get_by(something='asdf')

Comments (3)

  1. Former user Account Deleted

    see the atachement for the new error I get. I guess now it's get_by, selectfirst and selectfirst_by that is broken. It might be an oracle-only problem now.

  2. Log in to comment