Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date: Invalid value error #516

Closed
sirex opened this issue Oct 1, 2023 · 0 comments · Fixed by #517
Closed

Date: Invalid value error #516

sirex opened this issue Oct 1, 2023 · 0 comments · Fixed by #517
Assignees
Labels
action:getall bug Something isn't working

Comments

@sirex
Copy link
Collaborator

sirex commented Oct 1, 2023

When running following query:

URL=https://get-test.data.gov.lt/datasets/gov/rc/jar/iregistruoti/JuridinisAsmuo
http "$URL/?select(reg_data,ja_pavadinimas)&format(csv)&limit(1)&sort(reg_data)"

I get following error:

HTTP/1.1 200 OK
Transfer-Encoding: chunked
content-disposition: attachment; filename="JuridinisAsmuo.csv"


http: LogLevel.ERROR: ChunkedEncodingError:
InvalidChunkLength: got length b'', 0 bytes read

get-test.data.gov.lt logs show:

Traceback (most recent call last):
  File "spinta/utils/response.py", line 246, in aiter
    for data in stream:
  File "spinta/formats/csv/commands.py", line 59, in _render_csv
    for row in rows:
  File "spinta/utils/nestedstruct.py", line 15, in flatten
    for v in vals:
  File "spinta/accesslog/__init__.py", line 162, in log_response
    for row in rows:
  File "spinta/commands/read.py", line 126, in <genexpr>
    rows = (
  File "spinta/commands/read.py", line 216, in get_page
    for row in rows:
  File "spinta/backends/postgresql/commands/read.py", line 52, in getall
    expr = env.resolve(query)
  File "spinta/backends/postgresql/commands/query.py", line 463, in and_
    args, kwargs = expr.resolve(env)
  File "spinta/ufuncs/basequerybuilder/ufuncs.py", line 24, in paginate
    return env.resolve(_get_pagination_compare_query(page))
  File "spinta/backends/postgresql/commands/query.py", line 473, in or_
    args, kwargs = expr.resolve(env)
  File "spinta/backends/postgresql/commands/query.py", line 473, in or_
    args, kwargs = expr.resolve(env)
  File "spinta/backends/postgresql/commands/query.py", line 524, in compare
    return env.call(op, prop.dtype, value)
  File "spinta/backends/postgresql/commands/query.py", line 593, in compare
    raise exceptions.InvalidValue(dtype, op=op, arg=type(value).__name__)
spinta.exceptions.InvalidValue: Invalid value.
  Context:
    component: spinta.types.datatype.Date
    manifest: default
    schema: 2536
    dataset: datasets/gov/rc/jar/iregistruoti
    model: datasets/gov/rc/jar/iregistruoti/JuridinisAsmuo
    entity:
    property: reg_data
    attribute:
    type: date
    op: gt
    arg: date
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "uvicorn/protocols/http/httptools_impl.py", line 404, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "spinta/middlewares.py", line 29, in __call__
    await self.app(scope, receive, send)
  File "starlette/middleware/exceptions.py", line 83, in __call__
    raise RuntimeError(msg) from exc
RuntimeError: Caught handled exception, but response already started.

Might be related with:

@sirex sirex added bug Something isn't working action:getall labels Oct 1, 2023
@adp-atea adp-atea linked a pull request Oct 3, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action:getall bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant