You should (probably) also add the "person" to "team_tournament" for the added benefit that a person may switch teams between tournaments (or not play in one), so tracking participation with a triplet is a chunk of useful data.
Mike's approach with indexes is definitely the straightforward best approach you should start with, but depending on the amount of data and how things are searched/joined... you may eventually want to skip having extra indexes on the database (which take up filespace and edit operations) and use a function as the constraint, triggered by inserts and updates. This is probably only useful if you have hundreds of millions of records AND searching/maintaining the extra indexes negatively affects performance, but this situation does happen. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy/1e5f2ff5-0283-41c8-8cdd-1cb01816e0a7%40googlegroups.com.
