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
Error
Traceback (most recent call last):
File "/.../venv/lib/python3.11/site-packages/notion_client/client.py", line 118, in _parse_response
response.raise_for_status()
File "/.../venv/lib/python3.11/site-packages/httpx/_models.py", line 759, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '400 Bad Request' for url 'https://api.notion.com/v1/databases/58ec7ea06a0f4750bf20d805581b5bd6/query?filter_properties=Name&filter_properties=Status&filter_properties=Motivation%20cost'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/.../tests/api/test_notion_service.py", line 19, in test_fetch_tasks_count
counts = fetch_tasks_count()
^^^^^^^^^^^^^^^^^^^
File "/.../src/api/services/notion_service.py", line 62, in fetch_tasks_count
answer = notion.databases.query(
^^^^^^^^^^^^^^^^^^^^^^^
File "/.../venv/lib/python3.11/site-packages/notion_client/api_endpoints.py", line 132, in query
return self.parent.request(
^^^^^^^^^^^^^^^^^^^^
File "/.../venv/lib/python3.11/site-packages/notion_client/client.py", line 194, in request
return self._parse_response(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.../venv/lib/python3.11/site-packages/notion_client/client.py", line 126, in _parse_response
raise APIResponseError(response, body["message"], code)
notion_client.errors.APIResponseError: The schema for the database with the following ID is malformed: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
/usr/lib/python3.11/json/decoder.py:353: ResourceWarning: unclosed <ssl.SSLSocket fd=3, family=2, type=1, proto=6, laddr=('192.168.2.167', 47656), raddr=('104.18.41.2', 443)>
obj, end = self.scan_once(s, idx)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
The error is the same with NOTION_DATABASE_ID formatted either as: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
I know the NOTION_DATABASE_ID is valid because the same example is working as expected with notion-client==2.0.
Steps to Reproduce
pip install --force-reinstall -v notion-client==2.1 or the current last version (2.2.1)
run the example above with valid NOTION_API_TOKEN and NOTION_DATABASE_ID
Context (Environment)
Python 3.11.0rc1
notion-client>=2.1 (issue reproduced with 2.1.0 and 2.2.1, but no problem with 2.0.0)
OS Ubuntu 22.04.3 LTS
Possible fix
Something is wrong with 2.1 update or I missed a breaking change notice.
The text was updated successfully, but these errors were encountered:
victor-yon
changed the title
Malformed database ID
Malformed schema for database query
Dec 30, 2023
victor-yon
changed the title
Malformed schema for database query
Database query malformed schema
Dec 30, 2023
the error is issued by Notion's API, not the Python client
it tells you that your database query is malformed; not sure why it says "the database schema" but I'm confident that the problem isn't with the database id but with the query itself (i.e. changing the UUID format won't help)
as seen in your logs, you're running this query: 'https://api.notion.com/v1/databases/58ec7ea06a0f4750bf20d805581b5bd6/query?filter_properties=Name&filter_properties=Status&filter_properties=Motivation%20cost'. I don't see how it could work correctly with 2.0.0 since filter_properties only exists since 2.1.0.
Maybe you were using filter_properties before, but it was ignored with 2.0.0, and now that it's not, it's causing an error?
Anyway, I can't replicate with what you provided so far, so I'll go ahead and close the issue, but feel free to comment and I'll reopen if needed.
Expected Behavior
Make a query with a database ID with the documented format should not return an API error.
Current Behavior
When I do this request with
notion-client>=2.1
:I get this error message:
The error is the same with
NOTION_DATABASE_ID
formatted either as:xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
orxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
.I know the
NOTION_DATABASE_ID
is valid because the same example is working as expected withnotion-client==2.0
.Steps to Reproduce
pip install --force-reinstall -v notion-client==2.1
or the current last version (2.2.1
)NOTION_API_TOKEN
andNOTION_DATABASE_ID
Context (Environment)
2.1.0
and2.2.1
, but no problem with2.0.0
)Possible fix
Something is wrong with 2.1 update or I missed a breaking change notice.
The text was updated successfully, but these errors were encountered: