Skip to content

Tag: sqlalchemy

PostgreSQL NOT operator in SQLAlchemy

I’d like to achieve toggling a boolean flag with just one query. My query looks as follows: Does SQLAlchemy supports PostgreSQL NOT (https://www.postgresql.org/docs/current/functions-logical.html) operator. How this can be achieved different way? Answer As Adrian Klaver points out in their comment, SQLA…

Can’t Query and iterate through database

I am trying to filter only the rows that have the foreign id of 1 or in this case ‘Skincare’ I have tried both, but no matter what combo I try it either applies no filter, nothing at all shows up, or I get an error that it is not iterable. I want Answer I’m not sure what is going

SQLAlchemy changes value after commit

Seemingly out of nowhere, my Flask app is now inserting the same value for one column in a table in my database no matter what when it had been previously working. I have a model here: and code in my application: The result of the prints is So it looks like after the record is committed, the number changes an…

function object has no attribute ‘connect’

Seems there’s a problem with my sql alchemy connection, don’t get why? it works sometimes and then doesn’t the next. Also vs code isn’t auto recommending sql alchemy methods, maybe I’ve set it up wrong? –database.py file main file ERROR I GET: It seems to me that the query …