Database error :ia pukkaa (Internal server error)

Terve!

Ongelmani on että

curl -X POST   http://localhost:5500/pois   -H 'Content-Type: application/json'   -d '{
  "request": "pois",
  "geometry": {
    "bbox": [
      [8.8034, 53.0756],
      [8.7834, 53.0456]
    ],
    "geojson": {
      "type": "Point",
      "coordinates": [8.8034, 53.0756]
    },
    "buffer": 250
  }
}'

Tuottaa omaa serveriäni vasten:

{"code":500,"message":"Internal server error"}

Virhelogi:
ERROR Exception on /pois [POST]
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1960, in _exec_single_context
self.dialect.do_execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py”, line 924, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation “thethingy” does not exist
LINE 3: FROM thethingy
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 1463, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python3.9/site-packages/flask_cors/extension.py”, line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 870, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File “/deploy/app/openpoiservice/server/api/views.py”, line 134, in places
features = request_pois(all_args)
File “/deploy/app/openpoiservice/server/api/views.py”, line 164, in request_pois
response = query_builder.request_pois()
File “/deploy/app/openpoiservice/server/api/query_builder.py”, line 113, in request_pois
return self.generate_geojson_features(pois_query, params[‘limit’])
File “/deploy/app/openpoiservice/server/api/query_builder.py”, line 224, in generate_geojson_features
for q_idx, q in enumerate(query):
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py”, line 2812, in iter
result = self._iter()
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py”, line 2826, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py”, line 2306, in execute
return self._execute_internal(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py”, line 2191, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/context.py”, line 293, in orm_execute_statement
result = conn.execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1408, in execute
return meth(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py”, line 513, in _execute_on_connection
return connection._execute_clauseelement(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1630, in _execute_clauseelement
ret = self._execute_context(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1839, in _execute_context
return self._exec_single_context(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1979, in _exec_single_context
self._handle_dbapi_exception(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 2335, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1960, in _exec_single_context
self.dialect.do_execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py”, line 924, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation “thethingy” does not exist
LINE 3: FROM thethingy
[SQL: SELECT anon_1.osm_id AS anon_1_osm_id, anon_1.osm_type AS anon_1_osm_type, ST_Distance(anon_1.geom, ST_GeogFromText(%(param_1)s)) AS “ST_Distance_1”, ST_AsBinary(anon_1.geom) AS anon_1_geom, array_agg(thethingy_tags.key) AS keys, array_agg(thethingy_tags.value) AS values, array_agg(thethingy_categories.category) AS categories
FROM (SELECT thethingy.osm_type AS osm_type, thethingy.osm_id AS osm_id, thethingy.geom AS geom, thethingy.src_index AS src_index, thethingy.delflag AS delflag
FROM thethingy
WHERE ST_DWithin(ST_Intersection(ST_Buffer(ST_GeogFromText(%(param_2)s), %(ST_Buffer_1)s), ST_GeogFromText(%(param_3)s)), thethingy.geom, %(ST_DWithin_1)s)) AS anon_1 LEFT OUTER JOIN thethingy_tags ON anon_1.osm_type = thethingy_tags.osm_type AND anon_1.osm_id = thethingy_tags.osm_id LEFT OUTER JOIN thethingy_categories ON anon_1.osm_type = thethingy_categories.osm_type AND anon_1.osm_id = thethingy_categories.osm_id GROUP BY anon_1.osm_id, anon_1.osm_type, anon_1.geom]
[parameters: {‘param_1’: ‘POINT (8.8034 53.0756)’, ‘param_2’: ‘POINT (8.8034 53.0756)’, ‘ST_Buffer_1’: 250, ‘param_3’: ‘POLYGON ((8.7834 53.0456, 8.8034 53.0456, 8.8034 53.0756, 8.7834 53.0756, 8.7834 53.0456))’, ‘ST_DWithin_1’: 0}]
(Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)
ERROR Exception on /pois [POST]
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1960, in _exec_single_context
self.dialect.do_execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py”, line 924, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.UndefinedTable: relation “thethingy” does not exist
LINE 3: FROM thethingy
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 1463, in wsgi_app
response = self.full_dispatch_request()
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 872, in full_dispatch_request
rv = self.handle_user_exception(e)
File “/usr/local/lib/python3.9/site-packages/flask_cors/extension.py”, line 176, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 870, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python3.9/site-packages/flask/app.py”, line 855, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File “/deploy/app/openpoiservice/server/api/views.py”, line 134, in places
features = request_pois(all_args)
File “/deploy/app/openpoiservice/server/api/views.py”, line 164, in request_pois
response = query_builder.request_pois()
File “/deploy/app/openpoiservice/server/api/query_builder.py”, line 113, in request_pois
return self.generate_geojson_features(pois_query, params[‘limit’])
File “/deploy/app/openpoiservice/server/api/query_builder.py”, line 224, in generate_geojson_features
for q_idx, q in enumerate(query):
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py”, line 2812, in iter
result = self._iter()
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/query.py”, line 2826, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py”, line 2306, in execute
return self._execute_internal(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py”, line 2191, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/context.py”, line 293, in orm_execute_statement
result = conn.execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1408, in execute
return meth(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/sql/elements.py”, line 513, in _execute_on_connection
return connection._execute_clauseelement(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1630, in _execute_clauseelement
ret = self._execute_context(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1839, in _execute_context
return self._exec_single_context(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1979, in _exec_single_context
self._handle_dbapi_exception(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 2335, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py”, line 1960, in _exec_single_context
self.dialect.do_execute(
File “/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py”, line 924, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation “thethingy” does not exist
LINE 3: FROM thethingy
^

[SQL: SELECT anon_1.osm_id AS anon_1_osm_id, anon_1.osm_type AS anon_1_osm_type, ST_Distance(anon_1.geom, ST_GeogFromText(%(param_1)s)) AS “ST_Distance_1”, ST_AsBinary(anon_1.geom) AS anon_1_geom, array_agg(thethingy_tags.key) AS keys, array_agg(thethingy_tags.value) AS values, array_agg(thethingy_categories.category) AS categories
FROM (SELECT thethingy.osm_type AS osm_type, thethingy.osm_id AS osm_id, thethingy.geom AS geom, thethingy.src_index AS src_index, thethingy.delflag AS delflag
FROM thethingy
WHERE ST_DWithin(ST_Intersection(ST_Buffer(ST_GeogFromText(%(param_2)s), %(ST_Buffer_1)s), ST_GeogFromText(%(param_3)s)), thethingy.geom, %(ST_DWithin_1)s)) AS anon_1 LEFT OUTER JOIN thethingy_tags ON anon_1.osm_type = thethingy_tags.osm_type AND anon_1.osm_id = thethingy_tags.osm_id LEFT OUTER JOIN thethingy_categories ON anon_1.osm_type = thethingy_categories.osm_type AND anon_1.osm_id = thethingy_categories.osm_id GROUP BY anon_1.osm_id, anon_1.osm_type, anon_1.geom]
[parameters: {‘param_1’: ‘POINT (8.8034 53.0756)’, ‘param_2’: ‘POINT (8.8034 53.0756)’, ‘ST_Buffer_1’: 250, ‘param_3’: ‘POLYGON ((8.7834 53.0456, 8.8034 53.0456, 8.8034 53.0756, 8.7834 53.0756, 8.7834 53.0456))’, ‘ST_DWithin_1’: 0}]

… Olen tehnyt databasen initillä ja ilman virheitä, mutten pääse errorista eroon.

Välillä systeemi on rokannu, mut jostain päivityksestä ei tykänny.