Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Birtwell mbirtwell

  • London, UK
View GitHub Profile
@mbirtwell
mbirtwell / gist:aaccdb7972e1a7ed094b
Last active Dec 21, 2017
SQLAlchemy Enum recipe enhanced for use in postgresql arrays
View gist:aaccdb7972e1a7ed094b
# Based on http://techspot.zzzeek.org/2011/01/14/the-enum-recipe/
import six
from sqlalchemy.dialects import postgresql
from sqlalchemy.types import SchemaType, TypeDecorator, Enum
from sqlalchemy import __version__, text, cast
import re
if __version__ < '0.6.5':
raise NotImplementedError("Version 0.6.5 or higher of SQLAlchemy is required.")
You can’t perform that action at this time.