have you considered just using an UNSIGNED INT ?  MySQL offers support for such 
types.

The CHECK constraint is a good way to go as well, but unfortunately I believe 
MySQL does not actually enforce CHECK constraints (funny, huh?) .  Here's an SO 
question regarding that issue: 
http://stackoverflow.com/questions/5807231/mysql-check-constraint-alternative  .




On Jun 9, 2013, at 8:14 AM, Avishay Balderman <balder...@gmail.com> wrote:

> Hi
> I would like to create a table with an integer column.
> This column value must be >= 0.
> How can I enforce it using table defintion?
> i have looked here and it looks fine.
> http://docs.sqlalchemy.org/en/rel_0_8/core/schema.html?highlight=checkconstraint#sqlalchemy.schema.CheckConstraint
> Will it work against any DB?
> My backing DB is MySQL.
> 
> Thanks
> 
> Avishay
> 
> -- 
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to