This is a simplified version of my table:
class Alert(Base):
__tablename__ = 'alert'
id = Column(Integer, primary_key=True)
created_on = Column(DateTime(timezone=True))
category = Column(Unicode, nullable=False)
parameters = Column(ARRAY(Unicode), nullable=True)
When trying to insert the following multidimensional array into the table, I get a DataError telling me that my array is malformed.
DataError: (DataError) malformed array literal: "numbers"
LINE 1: ...RRAY[ARRAY['key', 'sXl5SoNh0KY'], ARRAY['nu...
^
DETAIL: Array value must start with "{" or dimension information.
'INSERT INTO alert (created_on, category, parameters)
VALUES (%(created_on)s, %(category)s, %(parameters)s)
RETURNING alert.id' {
'created_on': datetime.datetime(2015, 6, 24, 1, 52, 30, 631330, tzinfo=<UTC>)
'category': u'new_cases',
'parameters':
[[u'key', u'sXl5SoNh0KY'],
['numbers', [u'8129431', u'8669290', u'8754131', u'8871813', u'8927606']],
['status', 'all']]
}
I was under the impression that Postgres' ARRAY type is multidimensional regardless of how it is created (http://thread.gmane.org/gmane.comp.python.sqlalchemy.user/31186), so why is this error occurring?