Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with ordering #36

Open
steveoni opened this issue Nov 22, 2021 · 0 comments
Open

Issue with ordering #36

steveoni opened this issue Nov 22, 2021 · 0 comments

Comments

@steveoni
Copy link

While trying to use /aggregate and /facts this specific line for ordering

ordering, q, bindings = Ordering(self).apply(q, bindings, order)

is generating variables not in any of the tables

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) missing FROM-clause entry for table "anon_2"
LINE 2: FROM "R_kgDOGLhFbw4edfc924721abb77" ORDER BY anon_2.anon_1 A...

and here is the generated sql query

[SQL: SELECT NULL AS anon_1, count("R_kgDOGLhFbw4edfc924721abb77".activity_id) AS _count, sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_ADEFAS") AS "MONTO_ADEFAS.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_APROBADO") AS "MONTO_APROBADO.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_DEVENGADO") AS "MONTO_DEVENGADO.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_EJERCICIO") AS "MONTO_EJERCICIO.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_EJERCIDO") AS "MONTO_EJERCIDO.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_MODIFICADO") AS "MONTO_MODIFICADO.sum", sum("R_kgDOGLhFbw4edfc924721abb77"."MONTO_PAGADO") AS "MONTO_PAGADO.sum" 
FROM "R_kgDOGLhFbw4edfc924721abb77" ORDER BY anon_2.anon_1 ASC NULLS LAST, anon_2._count ASC NULLS LAST, anon_2."MONTO_ADEFAS.sum" ASC NULLS LAST, anon_2."MONTO_APROBADO.sum" ASC NULLS LAST, anon_2."MONTO_DEVENGADO.sum" ASC NULLS LAST, anon_2."MONTO_EJERCICIO.sum" ASC NULLS LAST, anon_2."MONTO_EJERCIDO.sum" ASC NULLS LAST, anon_2."MONTO_MODIFICADO.sum" ASC NULLS LAST, anon_2."MONTO_PAGADO.sum" ASC NULLS LAST 
 LIMIT %(param_1)s]
[parameters: {'param_1': 100}]

but commenting out the ordering line, the api works fine. is there something i'm doing wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant