Hi,
I'm trying to use sqlalchemy on virtual teiid database which emulates 
posgress. My virtual database requires schema name on select queries, for 
exampe:

SELECT "Bugzilla".bugs.bug_id AS "Bugzilla_bugs_bug_id", 
"Bugzilla".bugs.short_desc AS "Bugzilla_bugs_short_desc" FROM 
"Bugzilla".bugs where "Bugzilla".bugs.bug_id=1115513;

so I'm adding schema to my declarative_base: Base = 
declarative_base(metadata=MetaData(schema="Bugzilla")) for my Bugs table 
I'm using:

class Bug(Base):
    __tablename__ = "bugs"
 
    bug_id = Column(Integer, primary_key=True)
    short_desc = Column(String)


If I run a query: 
bugs = DBSession.query(Bug).filter_by(bug_id=1115513).all()
I'm getting an error saying NoSuchColumnError: "Could not locate column in 
row for column 'bugs.bug_id'"
I believe this is because select query that is generated looks like this:
2014-07-16 07:09:53,190 INFO  [sqlalchemy.engine.base.Engine][Dummy-2] 
SELECT "Bugzilla".bugs.bug_id AS "Bugzilla_bugs_bug_id", 
"Bugzilla".bugs.short_desc AS "Bugzilla_bugs_short_desc" FROM 
"Bugzilla".bugs  WHERE "Bugzilla".bugs.bug_id = 1115513

It appears as if sqlalchemy knows about the scheme on select and forgets 
about it when result is returned.

How do I make sure sqlalchemy expects columns: bugzilla_bugs_bug_id 
bugzilla_bugs_short_desc not bugs.bug_id?

Here's paste of the error: http://p.defau.lt/?oB9HEsHyPRaLveruhu9GMw

Many thanks for your help

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to