ordering of tables makes some relationships invalid
Using MySQL with InnoDB support, sqlite3, and probably numerous other engines allows for the specification of foreign keys directly in the database.
sqlacodegen responds to these specifications correctly in that it creates code for these relationships. However, in the code, it places certain classes after other classes that link to them.
For example, if a Participant table/class has a foreign key in an Individual table/class, the Individual class may follow the Participant class, resulting in sqlalchemy throwing an error like the following:
sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'participants.id' could not find table 'individuals' with which to generate a foreign key to target column 'id'
The classes can be rearranged manually for expected results (i.e., no errors being thrown).