I think I figure this out:


down voteunaccept

In addition to mentioning the SQL Server schema names as part of the table 
args, as in:

class UserGroup(Base):
    __tablename__ = 'user_group'
    __table_args__ = (
        {'schema': 'admn'})

The schema is named "admn".

You also have to mention the schema name in various strings in the ORM in 
which you are naming tables. Two examples I've found so far:

Foreign keys:

    user_id = Column(Integer, ForeignKey('admn.user.user_id', 
ondelete="cascade", onupdate="cascade"), primary_key = True)

In relationships when you mention a table, such as a secondary table:

  users = relationship(
        "User",
        secondary="admn.user_group",
        back_populates="groups",
        cascade="all",
        passive_deletes=True) 

It was this last place that was causing my mapper errors. IE as soon as I 
mentioned the schema name in secondary=... the mapper errors went away.

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to