Can't get last request from chapter "API Core" in the tutorial to work
chrischmo opened this issue · 9 comments
Hi!
I'm currently following the tutorial (thank you very much for it, very helpful) and I can't get the last request under "API Core" to work:
christian@Ubuntu-VM:~/khumbuicefall$ curl -s -G -H "Authorization: Bearer $JWT_TOKEN" http://localhost:8080/rest/clients --data-urlencode select="id,name,projects(id,name,comments(body),tasks(id,name,comments(body)))" | python -mjson.tool
I always get the following response:
{ "message": "Could not find foreign keys between these entities, No relation found between tasks and comments" }
All other requests from the "API Core" chapter as well as the ones from "Using the API" got the expected responses.
Steps I took so far trying to solve this:
- I double-checked several times if I maybe overlooked pieces of code in the previous sections of the tutorial, but everything seems to be in order – at least I hope so, see my data/API DDL files as well as the stored procedure for reference.
- Found a passage in the docs regarding schema reloading (link) that sounded promising, but issuing a
killall -HUP postgrest
just returnspostgrest: no process found
in my Ubuntu VM. - Restarted the postgrest and db containers from subzero-dashboard.
Any help/hints to solve this would be greatly appreciated!
Kind regards,
Christian
try docker-compose down && docker-compose up
Thanks! Just tried it, but unfortunately it didn't make a difference.
I originally followed the tutorial in the wiki on github. I compared the code given under http://docs.subzero.cloud/tutorial/core/ and it seems to be identical. As a precaution, I replaced the DDL statements from the wiki with the ones from the docs, but the error remains.
in subzero docs i don't see the request you mentioned from the wiki, maybe there was a problem with it. also recently there was a commit that makes relation detection better in postgrest, i'll have to investigate if it's related to that.
I might have the same problem for the same patterns, like use view for tables with foreign keys constraints. Access from the url with select for referenced foreign key view tables will have the same problem.
@chrischmo @nphard can you try this postgrest image and see the relation is detected? subzerocloud/postgrest
In my own project that I'm working on I have something similar and with the official image resource embedding doesn't work, whereas now it works perfectly. Thank you, @ruslantalpa!
closing this since a lot has changed both in the core product and the tutorials (which were checked again)