Closed pmussak closed 7 months ago
Maybe related to https://github.com/iiasa/ixmp4/pull/37 ?
Sounds like the model table is getting joined multiple times accidentally there ...
Probably just requires adding a if utils.is_joined(...)
check in the right place.
thanks @meksor I will try to fix it then
@meksor I commited the non-working fix to this branch: origin/bug/rest-meta-endpoint-error
I found another problem with the REST meta endpoint.
The parameter join_run_index
is only properly handled when table == True
.
If table == False
and join_run_index
is not explicitly set, it still gets set to default (false) and then is not handled by the list
method and therefor throws an illegal filter error (see "error response for third request" in the issue description).
I build a quick fix for that and committed it to origin/bug/rest-meta-endpoint-error as well.
OK, I've done some investigating:
Lets get the easy one out of the way first:
3's behaviour is almost correct using join_run_index
without table=True
should result in a 400. The error message is incorrect though and caused by an unrelated part of the code. Ill add an explicit 'check and raise' in the rest layer.
1 is trickier, i suspected at first that the model table is being joined twice. This is not the case however, it looks like there is a problem with selecting the model.name
column as model
and joining the model
table as for some reason the postgres version (15) on the server does not like this ambiguity. My local (i think newer, 16?) postgres does not care and handles the query as expected... Same thing for sqlite, it doesnt care.
@meksor thanks for looking into this! 1 sounds like it was a pain to debug
Fix here: https://github.com/iiasa/ixmp4/pull/69
I am using the
meta
REST endpoint inixmp4-ts
. While developing I found that,calls for
https://ixmp.ece.iiasa.ac.at/v1/genie/meta/?join_run_index=true&table=true
result in HTTP 500 ** context: current prod deployment of ixmp4 (0.7.1)calls for
https://ixmp.ece.iiasa.ac.at/v1/genie/meta/?table=true
work as expectedcalls for
https://ixmp.ece.iiasa.ac.at/v1/genie/meta/?join_run_index=true
result in HTTP 400 ***I expect that all three requests result in HTTP 2** responses with data in the result.
** ixmp4 error log for first request
*** error response for third request