You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SELECT db_dbnode_1.id
FROM db_dbnode AS db_dbnode_1
WHERE CAST(db_dbnode_1.node_type AS VARCHAR) LIKE 'data.structure.%' AND CAST((db_dbnode_1.extras #> '{optimade, elements}') AS JSONB) @> '["Si"]'
This is still probably not complete (we should check the other base types as well as dictionaries) but is a good start.
Should we implement this (or an extension of it) in the method returning the __str__ representation of a QueryBuilder?
Pinging @ramirezfranciscof (who maybe could implement this?) and @CasperWA as this is related to his OPTIMADE-related queries
The text was updated successfully, but these errors were encountered:
SELECT db_dbnode_1.id, db_dbnode_1.uuid, db_dbnode_1.node_type, db_dbnode_1.process_type, db_dbnode_1.label, db_dbnode_1.description, db_dbnode_1.ctime, db_dbnode_1.mtime, db_dbnode_1.attributes, db_dbnode_1.extras, db_dbnode_1.user_id, db_dbnode_1.dbcomputer_id
FROM db_dbnode AS db_dbnode_1
WHERE CAST(db_dbnode_1.node_type AS VARCHAR) LIKE 'process.calculation.calcjob.%%' AND CASE WHEN (jsonb_typeof(db_dbnode_1.attributes #> %(attributes_1)s) = 'number') THEN CAST((db_dbnode_1.attributes #>> '{last_job_info, wallclock_time_seconds}') AS FLOAT) < 400 ELSE false END
with q = qb.get_query(); print(render_query(q, q.session)):
SELECT db_dbnode_1.id, db_dbnode_1.uuid, db_dbnode_1.node_type, db_dbnode_1.process_type, db_dbnode_1.label, db_dbnode_1.description, db_dbnode_1.ctime, db_dbnode_1.mtime, db_dbnode_1.attributes, db_dbnode_1.extras, db_dbnode_1.user_id, db_dbnode_1.dbcomputer_id
FROM db_dbnode AS db_dbnode_1
WHERE CAST(db_dbnode_1.node_type AS VARCHAR) LIKE 'process.calculation.calcjob.%' AND CASE WHEN (jsonb_typeof(db_dbnode_1.attributes #> '{last_job_info, wallclock_time_seconds}') = 'number') THEN CAST((db_dbnode_1.attributes #>> '{last_job_info, wallclock_time_seconds}') AS FLOAT) < 400 ELSE False END
In particular note how #> %(attributes_1)s) is left in the print statement, while it's correctly replaced with #> '{last_job_info, wallclock_time_seconds}') below.
If I instantiate this query builder object:
and then I print it (
print(qb)
), I get an exception:By taking inspiration from this page, I adapted a bit (for JSONB rather than array, and with a fix for strings:
This now works:
returns
This is still probably not complete (we should check the other base types as well as dictionaries) but is a good start.
Should we implement this (or an extension of it) in the method returning the
__str__
representation of a QueryBuilder?Pinging @ramirezfranciscof (who maybe could implement this?) and @CasperWA as this is related to his OPTIMADE-related queries
The text was updated successfully, but these errors were encountered: