I'm trying to create a functional index (with the PostgreSQL function lower()). I get this error when using Alembic to create the table:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) column "lower" does not exist
'CREATE INDEX ix_cities_name ON cities (lower)' {}
Here's the code:
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
db = SQLAlchemy(app)
class City(db.Model):
__tablename__ = 'cities'
name = db.Column(db.String(100), nullable=False)
db.Index('ix_cities_name', db.func.lower(db.metadata.tables['cities'].c.name))