It appears that if during runtime I assign a schema to declarative, then `inspect()` it, the resulting Selectable does not have the schema assigned to it:
in model.py: from sqlalchemy import Column, String, DateTime from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class MyClass(Base): __tablename__ = 'mytable' username = Column(String(128), primary_key=True) in run.py: from sqlalchemy import create_engine, inspect from model import MyClass engine = sqlalchemy.create_engine(...) MyClass.schema = 'notme' # I just want to do a manual select on the table not use a session mytable = inspect(MyClass).local_table result = engine.execute(mytable.select().first()) #This fails because for the given connection the select table must be qualified under schema 'notme' #The solution seems to be to assign schema to the Selectable itself, not the declarative: mytable.schema = 'notme' Is this an expected behavior? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 sqlalchemy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/a2270e39-d211-461c-af20-fb73a886086co%40googlegroups.com.