On Wed, Jun 11, 2008 at 7:55 PM, Michael Hipp <[EMAIL PROTECTED]> wrote:
>
>
> Can anyone offer me a "best practice" on how to do enumerations in Elixir/SA?
>
> e.g. When you have column like 'order_status' and it needs to hold one of the
> values representing perhaps "waiting for approval", "processing", "shipped", 
> etc.
>
> How do you call this out and where is the best place to put the descriptions
> and code?

See:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Enum
though I'm not sure that recipe is uptodate with latest version of
SQLAlchemy. Please report back if you have any problem, I'll get you
the correct version if needed.

You can use custom types like that in Elixir as well.

You'd simply write:
class MyStuff(Entity):
    e = Field(Enum([u'foobar', u'baz', u'quux', None]))

-- 
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