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

Errors on some queryables requests #420

Closed
justb4 opened this issue Apr 25, 2020 · 2 comments · Fixed by #422
Closed

Errors on some queryables requests #420

justb4 opened this issue Apr 25, 2020 · 2 comments · Fixed by #422
Labels
bug Something isn't working

Comments

@justb4
Copy link
Member

justb4 commented Apr 25, 2020

Description
Some Collections give error when requesting queryables.

Steps to Reproduce

Expected behavior
List of queryable fields or empty.

Screenshots/Tracebacks
See e.g. https://demo.pygeoapi.io/master/collections/dutch_windmills/queryables
gives:
Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

for all endpoints using master version.
In some cases also error log output (e.g. docker logs --follow pygeoapi_covid-19) is shown, like on
https://demo.pygeoapi.io/covid-19/collections/cases/queryables

[2020-04-25T10:43:45Z] {/usr/local/lib/python3.8/dist-packages/flask/app.py:1891} ERROR - Exception on /collections/cases/queryables [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/dist-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/dist-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/dist-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/pygeoapi/pygeoapi/flask_app.py", line 181, in get_collection_queryables
    headers, status_code, content = api_.get_collection_queryables(
  File "/pygeoapi/pygeoapi/api.py", line 88, in inner
    return func(cls, headers_, format_, *args, **kwargs)
  File "/pygeoapi/pygeoapi/linked_data.py", line 54, in inner
    return func(*args, **kwargs)
  File "/pygeoapi/pygeoapi/api.py", line 518, in get_collection_queryables
    'type': v['type']
TypeError: string indices must be integers

Environment

  • OS: any
  • Python version: 3
  • pygeoapi version: master

Additional context
NA

@tomkralidis
Copy link
Member

Reproduced. Looks like some updates are needed to OGR, PostgreSQL, SQLite (cc @jorgejesus) and MongoDB (cc @timtuun) providers.

A provider's get_fields method should return a dict structured like:

{
    'field1': {
        'type': 'string'
    },
    'field2: {
        'type': 'int'
    }
}

Examples:

@tomkralidis
Copy link
Member

Fixed via 11ee705 and 6916099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants