This repository was archived by the owner on Oct 22, 2024. It is now read-only.
Replies: 1 comment
-
https://deta.space/docs/en/build/reference/deta-base/queries |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have 2 commands
student = db.fetch({'key': key1})and
students = db.fetch( [ {'key': key1}, {'key': key2} )the 1st one works but the 2nd one doesn't and gives me an error (shown below). I guess I could make 1 query at a time, but that's rather inefficient. Any help would be great.
Traceback (most recent call last):
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/chieh/code/streamlit_teaching_materials/pages/teacher_course_page.py", line 51, in
student2 = db.fetch([{'key':student_keys[0]}, {'key':student_keys[1]}, {'key':student_keys[2]}]).items
File "/home/chieh/.local/lib/python3.8/site-packages/deta/base.py", line 203, in fetch
_, res = self._fetch(query, limit, last)
File "/home/chieh/.local/lib/python3.8/site-packages/deta/base.py", line 189, in _fetch
code, res = self._request("/query", "POST", payload, content_type=JSON_MIME)
File "/home/chieh/.local/lib/python3.8/site-packages/deta/service.py", line 85, in _request
raise urllib.error.HTTPError(url, status, res.reason, res.headers, res.fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
Exception in thread ScriptRunner.scriptThread:
Traceback (most recent call last):
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
exec(code, module.dict)
File "/home/chieh/code/streamlit_teaching_materials/pages/teacher_course_page.py", line 51, in
student2 = db.fetch([{'key':student_keys[0]}, {'key':student_keys[1]}, {'key':student_keys[2]}]).items
File "/home/chieh/.local/lib/python3.8/site-packages/deta/base.py", line 203, in fetch
_, res = self._fetch(query, limit, last)
File "/home/chieh/.local/lib/python3.8/site-packages/deta/base.py", line 189, in _fetch
code, res = self._request("/query", "POST", payload, content_type=JSON_MIME)
File "/home/chieh/.local/lib/python3.8/site-packages/deta/service.py", line 85, in _request
raise urllib.error.HTTPError(url, status, res.reason, res.headers, res.fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 299, in _run_script_thread
self._run_script(request.rerun_data)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 616, in _run_script
self._run_script(rerun_exception_data)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 578, in _run_script
handle_uncaught_app_exception(uncaught_exception)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/error_util.py", line 96, in handle_uncaught_app_exception
st.exception(ex)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/runtime/metrics_util.py", line 311, in wrapped_func
result = non_optional_func(*args, **kwargs)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/elements/exception.py", line 68, in exception
marshall(exception_proto, exception)
File "/home/chieh/.local/lib/python3.8/site-packages/streamlit/elements/exception.py", line 105, in marshall
if getattr(exception, "alternate_name", None) is not None:
File "/usr/lib/python3.8/tempfile.py", line 606, in getattr
file = self.dict['file']
KeyError: 'file'
Beta Was this translation helpful? Give feedback.
All reactions