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
from datetime import timedelta
from aiida.common import timezone
now = timezone.now()
qb = QueryBuilder()
qb.append(
CalcJobNode,
filters={'ctime':{'>': now - timedelta(days=4)}},
project={'id':{'func':'count'}}
)
qb.append(
Dict,
filters={'attributes.energy':{'>':-5.0}},
edge_filters={'label':{'like':'output_%'}},
edge_project='label'
)
I get the following error:
ProgrammingError: (psycopg2.errors.GroupingError) column "db_dblink_1.label" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ...HOLD FOR SELECT count(db_dbnode_1.id) AS count_1, db_dblink_...
^
[SQL: SELECT count(db_dbnode_1.id) AS count_1, db_dblink_1.label AS db_dblink_1_label
FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id
WHERE CAST(db_dbnode_1.node_type AS VARCHAR) LIKE %(param_1)s AND db_dbnode_1.ctime > %(ctime_1)s AND CAST(db_dbnode_2.node_type AS VARCHAR) LIKE %(param_2)s AND CASE WHEN (jsonb_typeof(db_dbnode_2.attributes #> %(attributes_1)s) = %(param_3)s) THEN CAST((db_dbnode_2.attributes #>> %(attributes_1)s) AS FLOAT) > %(param_4)s ELSE %(param_5)s END AND CAST(db_dblink_1.label AS VARCHAR) LIKE %(param_6)s]
[parameters: {'param_1': 'process.calculation.calcjob.%', 'ctime_1': datetime.datetime(2019, 7, 26, 16, 33, 27, 209862, tzinfo=<UTC>), 'param_2': 'data.dict.%', 'attributes_1': '{energy}', 'param_3': 'number', 'param_4': -5.0, 'param_5': False, 'param_6': 'output_%'}]
(Background on this error at: http://sqlalche.me/e/f405)
Moreover, after such an error QueryBuilder does not work any longer (all further attempts to run a query result in the same error).
The problem comes from different size of projections. In the first case the projection is [[29]], while in the second case it is [['output_parameters'], ..., ['output_parameters']] that have different size.
It would be nice to handle properly such an error and to keep QueryBuilder operational.
The text was updated successfully, but these errors were encountered:
@CasperWA thanks for the heads up! I just checked and I only project once in each query, so I think I should be safe in regards to this issue, correct?
If I run a query
I get the following error:
Moreover, after such an error
QueryBuilder
does not work any longer (all further attempts to run a query result in the same error).The problem comes from different size of projections. In the first case the projection is
[[29]]
, while in the second case it is[['output_parameters'], ..., ['output_parameters']]
that have different size.It would be nice to handle properly such an error and to keep
QueryBuilder
operational.The text was updated successfully, but these errors were encountered: