I'm trying to create a table in SQLAlchemy where the email column is an array of email addresses. However, I'm getting this error:
AttributeError: "'module' object has no attribute 'ARRAY'"
I looked up in the docs http://docs.sqlalchemy.org/en/latest/core/type_basics.html#sqlalchemy.types.ARRAY
but I guess I didn't understand the correct implementation.
import datetime
from sqlalchemy import schema, types
from sqlalchemy import orm
metadata = schema.MetaData()
def now():
return datetime.datetime.now()
page_table = schema.Table('candidate', metadata,
schema.Column('id', types.Integer, schema.Sequence('page_seq_id', optional=True), primary_key=True),
schema.Column('email', types.ARRAY(String), nullable=False),
schema.Column('first', types.Unicode(255), nullable=False),
schema.Column('last', types.Unicode(255), nullable=False),
schema.Column('company', types.Unicode(255), nullable=False),
schema.Column('title', types.Unicode(255), nullable=False),
schema.Column('linkedin', types.Unicode(255), nullable=False, unique=True),
)
class Candidate(object):
pass
orm.mapper(Candidate, page_table)
Can any suggest how to make this work?