EDIT: I am using simple-salesforce with the REST API to make requests.
I'm trying to get for each Case all the EmailMessages, and for each EmailMessage, all its ContentDocumentLinks (from which I can get the ContentDocument).
This query fails with "Malformed Query":
SELECT
Id,
(
SELECT
Id,
(
SELECT
Id
FROM
ContentDocumentLinks
)
FROM
EmailMessages
)
FROM
Case
LIMIT 1
However these two queries work perfectly:
SELECT
Id,
(
SELECT
Id
FROM
ContentDocumentLinks
)
FROM
EmailMessage
LIMIT 1
SELECT
Id,
(
SELECT
Id
FROM
EmailMessages
)
FROM
Case
LIMIT 1
What did I miss? Is there a way to achieve what I wanted?