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

Failing to fetch data without WHERE statements #989

Closed
Somebi opened this issue Dec 16, 2024 · 1 comment
Closed

Failing to fetch data without WHERE statements #989

Somebi opened this issue Dec 16, 2024 · 1 comment

Comments

@Somebi
Copy link

Somebi commented Dec 16, 2024

Throwing error if no where statements in the query.

Code:

    yql_query = f"select id, image_url, created_at from images {where_clause if where_clause else 'where true'}"
    query_body = {
        "hits": params.per_page,
        "offset": offset
    }
    response = vespa_app.query(yql=yql_query, body=query_body)

Error:

  File "/home/beck/.local/share/virtualenvs/api-bjhqPKPA/lib/python3.11/site-packages/vespa/application.py", line 316, in query
    return sync_app.query(body=body, groupname=groupname, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/beck/.local/share/virtualenvs/api-bjhqPKPA/lib/python3.11/site-packages/vespa/application.py", line 1236, in query
    raise_for_status(response)
  File "/home/beck/.local/share/virtualenvs/api-bjhqPKPA/lib/python3.11/site-packages/vespa/application.py", line 73, in raise_for_status
    raise VespaError(errors) from http_error
vespa.exceptions.VespaError: [{'code': 4, 'summary': 'Invalid query parameter', 'message': 'Could not create query from YQL: Expected operator FILTER, got SCAN.'}]

This one is failing:
select id, image_url, created_at from images

Working only if specified like this:
select id, image_url, created_at from images where true

@thomasht86
Copy link
Collaborator

This is as expected. See https://docs.vespa.ai/en/reference/select-reference.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants