I'm trying to query an array of bigint[] using SQLAlchemy 0.8 on a Postgresql database.
My query looks like this:
ways_with_node = db.query(Ways).filter(Ways.nodes.contains(array([
node1.id], type_=BigInteger))).all()
and I'm getting the following exception:
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) operator does not exist: bigint[] @> integer[]
LINE 3: WHERE ways.nodes @> ARRAY[ -710]
It looks like the array() function isn't changing the type to BigInteger. I've tried CHAR and the second argument remains an integer[] array.
The query should end up looking something like this:
select * from ways where nodes @> '{-710}'::bigint[]
Which successfully executes as plain SQL. I've tried different variations of the query, including:
db.query(Ways).filter(Ways.nodes.op('@>')(array([
node1.id], type_=BigInteger))).all()
but the result is the same exception. Since I have run out of ideas, I was wondering if there is a bug in the array() function or if I'm doing something wrong here.