Using SQLAlchemy and Python with PostgreSQL as the database. I have a table with more than 32 columns and I am getting the following error:
cannot use more than 32 columns in an index
Here's a code snippet of how I am creating the tables:
class Application():
__tablename__ = 'application'
id = Column(Integer, primary_key=True)
name = Column(String)
value = Column(Integer)
# ..and many other columns (45 columns in total)
_columns = ['name', 'value'...] # a list of 45 column names
__table_args__ = (UniqueConstraint(*_columns),)
Seems like there is a build option for PostgreSQL to increase the number of columns to more than 32: http://www.postgresql.org/docs/8.3/static/indexes-multicolumn.html From the above link:
This limit can be altered when building PostgreSQL; see the file pg_config_manual.h
But wondering if there is a way to limit the index to fewer than 32 columns when creating a table through SQLAlchemy APIs. I really don't like the having to rebuild the PostgreSQL database for this.