An exception occured

Exception Message

(psycopg2.errors.UndefinedFunction) function st_distance_sphere(geometry, geometry) does not exist LINE 4: ...ots.system_id = 487 AND core.spots.status = 1 AND ST_Distanc... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. [SQL: SELECT count(*) AS count_1 FROM (SELECT core.spots.id AS core_spots_id, core.spots.name AS core_spots_name, core.spots.status AS core_spots_status, core.spots.category AS core_spots_category, core.spots.location AS core_spots_location, core.spots.moving AS core_spots_moving, core.spots.custom_meta AS core_spots_custom_meta, core.spots.created_at AS core_spots_created_at, core.spots.last_update AS core_spots_last_update, core.spots.external_link AS core_spots_external_link, core.spots.geofence_radius_meters AS core_spots_geofence_radius_meters, core.spots.system_id AS core_spots_system_id, core.spots.cover_image_id AS core_spots_cover_image_id, core.spots.content_id AS core_spots_content_id, core.spots.synchronization_id AS core_spots_synchronization_id, core.spots.last_synchronization AS core_spots_last_synchronization FROM core.spots WHERE core.spots.system_id = %(system_id_1)s AND core.spots.status = %(status_1)s AND ST_Distance_Sphere(core.spots.location, ST_GeomFromEWKT(%(ST_GeomFromEWKT_1)s)) <= %(ST_Distance_Sphere_1)s AND core.spots.moving = false AND core.spots.location IS NOT NULL ORDER BY core.spots.name) AS anon_1] [parameters: {'system_id_1': 487, 'status_1': 1, 'ST_GeomFromEWKT_1': 'SRID=4326;POINT(0 0)', 'ST_Distance_Sphere_1': 200.0}] (Background on this error at: http://sqlalche.me/e/f405)

Exception Type

<class 'sqlalchemy.exc.ProgrammingError'>

Traceback

Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) psycopg2.errors.UndefinedFunction: function st_distance_sphere(geometry, geometry) does not exist LINE 4: ...ots.system_id = 487 AND core.spots.status = 1 AND ST_Distanc... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/service/exception_decor.py", line 30, in wrapped_f return f(*a, **ka) ^^^^^^^^^^^ File "/app/service/nearby.py", line 100, in get_nearby system, spots, language, settings, style, menu, mwp_asset, rodl = get_data(transaction, api_key, 10, query_location, 200) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/service/nearby.py", line 49, in get_data spots, cursor, has_more, total_num_results = rodl.query_spots_by_location( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/xp_db_models/read_only_data_loader.py", line 316, in query_spots_by_location page, cursor, has_more, total_num_results = DBSpot.query(self.transaction, cursor, page_size, sort_expressions, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/xp_db_models/spot.py", line 1093, in query return query(q, cursor, page_size) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/xp_db/query.py", line 62, in query total_num_results = q.count() ^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3561, in count return self.from_self(col).scalar() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3305, in scalar ret = self.one() ^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3275, in one ret = self.one_or_none() ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3244, in one_or_none ret = list(self) ^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3317, in __iter__ return self._execute_and_instances(context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 3342, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement ret = self._execute_context( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1247, in _execute_context self._handle_dbapi_exception( File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 128, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1243, in _execute_context self.dialect.do_execute( File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) function st_distance_sphere(geometry, geometry) does not exist LINE 4: ...ots.system_id = 487 AND core.spots.status = 1 AND ST_Distanc... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. [SQL: SELECT count(*) AS count_1 FROM (SELECT core.spots.id AS core_spots_id, core.spots.name AS core_spots_name, core.spots.status AS core_spots_status, core.spots.category AS core_spots_category, core.spots.location AS core_spots_location, core.spots.moving AS core_spots_moving, core.spots.custom_meta AS core_spots_custom_meta, core.spots.created_at AS core_spots_created_at, core.spots.last_update AS core_spots_last_update, core.spots.external_link AS core_spots_external_link, core.spots.geofence_radius_meters AS core_spots_geofence_radius_meters, core.spots.system_id AS core_spots_system_id, core.spots.cover_image_id AS core_spots_cover_image_id, core.spots.content_id AS core_spots_content_id, core.spots.synchronization_id AS core_spots_synchronization_id, core.spots.last_synchronization AS core_spots_last_synchronization FROM core.spots WHERE core.spots.system_id = %(system_id_1)s AND core.spots.status = %(status_1)s AND ST_Distance_Sphere(core.spots.location, ST_GeomFromEWKT(%(ST_GeomFromEWKT_1)s)) <= %(ST_Distance_Sphere_1)s AND core.spots.moving = false AND core.spots.location IS NOT NULL ORDER BY core.spots.name) AS anon_1] [parameters: {'system_id_1': 487, 'status_1': 1, 'ST_GeomFromEWKT_1': 'SRID=4326;POINT(0 0)', 'ST_Distance_Sphere_1': 200.0}] (Background on this error at: http://sqlalche.me/e/f405)