I am using SQLAlchemy 0.9 with Python 2.7.6 and Flask. I receive form data, place it into object and add the objects to the session. When I try to do a db.commit() I get a rollback which seems to due to the relationship object in the INSERT statement. The SQL error is as follows:
The relationship code in the model is as follows:
What is it about the relationship object that causes the rollback? I am new to SQLAlchemy and so have followed what it says in the documentation regarding relationships. Both of the data types in the models (Site, School) are ints. |
--
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 post to this group, send email to sqlal...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.
How can I do this using the declarative base method?Thanks for your informative answer!I have a secondary problem now having changed my model to use declarative base - as in db.create_all() does not create my tables in the database.
On Feb 5, 2014, at 9:43 AM, Jude Lucien <jlu...@gmail.com> wrote:How can I do this using the declarative base method?I have a secondary problem now having changed my model to use declarative base - as in db.create_all() does not create my tables in the database.Base.metadata is where you’d call create_all(my engine) from.
--
You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/yl_5BnwzfhA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sqlalchemy+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
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 sqlalchemy+...@googlegroups.com.