How to add size of the postgres array in SQLAlchemy?

Like SQL type Integer[2]:

column = Column(postgresql.ARRAY(Integer), size=2)
share|improve this question

71% accept rate
feedback

1 Answer

up vote 4 down vote accepted

In PostgreSQL you just define the column as ARRAY of some base type, like integer[]. You can include dimensions in the type declaration, like integer[3][3], but they are without effect, as they are not enforced. I quote the manual here:

However, the current implementation ignores any supplied array size limits, i.e., the behavior is the same as for arrays of unspecified length.

share|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.