Skip to content

Tag: python

Case in Sqlalchemy hybrid_property / expression error

I want to use expressions is ORM queries like this. Profile.query.filter(Profile.complete).all() Where complete is a calculated field Sqlalchemy docs shows the below So i’ve attempted to copy it with the following. But the output sql query is as below – the case isn’t compared agaisnt anythi…

python function parameter control

I have a function called “getBooks”, and this function is actually a combination of 2 functions. one function must work without taking the ‘name’ parameter, the other must work by taking the ‘name’ parameter because i have to change the sql template according to the ‘…

Python – Printing output into a SQL Table

I have a python script that can extract the metadata from pictures in a directory. As of right now they go into a text file in table format and the current output looks like this: Here is the current script I have: The script opens the directory and for each photo it takes the filename, size, type, height, wi…

python how to write an update sql query?

I am trying to write an update query but I could not manage the string. My connections is ok. My query is like this: This is giving me error: undefined column name ‘hello’. I want to update message column as hello but it is getting it as a column name. In sql, when I write it as UPDATE users SET