I have a Column(Integer) called object_id. I assign to it a string or
unicode value, eg. object_id = u"not an integer". To my surprise, this
doesn't raise any kind of exception when the row is committed. I can
then expunge the session and request that row back, getting a Unicode
object for that column.

I understand that sqlite is very weakly typed and that you can do this
sort of thing easily. But I thought that SQLAlchemy would apply some
logic in the middle to ensure that an Integer column only takes
something integral. I would understand if I'd passed "30" or some
other string that could be coerced to an integer, but this doesn't fit
that constraint.

So, 2 questions:

a) Is this expected behaviour?
b) How can I catch this, ideally at the SQLAlchemy level, so that I
can't accidentally store a string as an integer?

--
Ben Sizer

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to