On Thu, May 21, 2009 at 16:37, Samus_ <[email protected]> wrote:

> hi guys, is this the proper way to create a column check?
> using_table_options(CheckConstraint('mycol > 0'))
>
> I'm asking this because I was first using UniqueConstraint for column
> indexes but later found that it can be passed as kwarg and
> UniqueConstraint is used only for multicolumn indexes, so maybe this
> has a shortcut as well.

As explained at:
http://www.sqlalchemy.org/docs/05/metadata.html#check-constraint
you can also put it directly in the column definition. This syntax is
not much shorter but it can be useful anyway.

In Elixir terms, that'd translate to:

mycol = Field(Integer, CheckConstraint('mycol > 0'))

-- 
Gaƫtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to