Skip to content
Advertisement

Can’t write SqlAlchemy query with contains operation

Let’s say that we have a two tables: Movie and Genre. Genre has an attribute genres which is a PostgreSQL ARRAY of genre ids. I have written a query to get all movie ids with genre names.

But sadly I am getting:

So, how can I rewrite my query to get what I want?

Advertisement

Answer

Remove the square brackets [] and use any:

Generated SQL:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement