Hi,
I want to translate this MariaDB query to sqlalchemy :
SELECT JSON_VALUE(user.meta, '$.code') AS code
FROM user
HAVING code IS NOT NULL;
(Note: the use of HAVING is because I want to filter on the alias `code`.)
I don't find a simple way to use the alias in comparison, currently I wrote
this code :
code = func.json_value(User.meta, '$.code').label('code')
db.query(code).having(literal_column(code.name)!=None).all()
Is this correct ? Is there any better way to do that ?
Thank you
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.