default schema is only queried the first time an Engine is used. it sounds like you're making an Engine per Session, which is an antipattern. Make just one engine per database URL per app.
On Apr 10, 2013, at 5:34 PM, Philip Russell <[email protected]> wrote: > Hi, apologies if this has been asked before (didn't see so in search) > > Background: > - Python 2.7 > - SQLAlchemy 0.8.2 > - pyodbc 3.0.6 > - FreeTDS 0.82-1 > > Connecting to MSSQL, and have a bunch of explicit schema settings in my Model > classes: > > class MyTable(Base): > __tablename__ = 'my_table' > > __table_args__ = {"schema" : "dbo"} > .... > > When I issue anything in a Session, it always issues the following first: > > 2013-04-10 13:54:38,154 INFO sqlalchemy.engine.base.Engine SELECT user_name() > 2013-04-10 13:54:38,157 INFO sqlalchemy.engine.base.Engine () > 2013-04-10 13:54:38,177 INFO sqlalchemy.engine.base.Engine > SELECT default_schema_name FROM > sys.database_principals > WHERE name = ? > AND type = 'S' > > My question is, is the above necessary? I'm explicitly setting the schema for > each Base model, so I'd expect it wouldn't need to know the default schema. > > If the query isn't necessary, is there a way to prevent it from being issued? > > Thanks, > > -Phil > > -- > 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
