Skip to content
Advertisement

Tag: sqlalchemy

Writing a hybrid method using pathlib (accessing properties)

I’m trying to do some path-checking logic on some values in a database. I’m having trouble implementing the class level expression for the hybrid method. Here is some stripped down code: I’m getting the error: Neither ‘Function’ object nor ‘Comparator’ object has an attribute ‘parents’ So I have to create a SQL expression for this function, but I’m not sure

How to union two counts queries in SQLAlchemy?

I have two queries and the only difference between then is that one is counting the success status and the other failure status. Is there a way to get this result in just one query? I’m using SQLALchemy to do the queries. Answer You can use conditions on Count, your query will look like:

Advertisement