I haven't followed your code in detail, but I think the problem might be here:
clazz = school.Class('12', 'A')
students = [
Student("Name1", "Sname1", clazz=clazz, code='aa7'),
Student("Name2", "Sname2", clazz=clazz, code='bb7'),
Student("Name3", "Sname3", clazz=clazz, code='cc7')
]
You are creating an instance of "school.Class", which is the
non-sqlalchemy base class. You probably meant to create an instance of
"Class", which is the SQLAlchemy-mapped subclass, didn't you?
Simon
> --
> 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+...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/b3e6fb67-6cab-4484-8c39-a01999640e67n%40googlegroups.com.