forked from hans/Nominatim
band-aid for SQLAlchemy 1.4
This commit is contained in:
@@ -93,6 +93,14 @@ class BaseLogger:
|
|||||||
for k in extra_params[0]:
|
for k in extra_params[0]:
|
||||||
params[k] = f':{k}'
|
params[k] = f':{k}'
|
||||||
|
|
||||||
|
sqlstr = str(compiled)
|
||||||
|
|
||||||
|
if '%s' in sqlstr:
|
||||||
|
try:
|
||||||
|
return sqlstr % tuple((repr(compiled.params[name]) for name in compiled.positiontup))
|
||||||
|
except TypeError:
|
||||||
|
return sqlstr
|
||||||
|
|
||||||
return str(compiled) % params
|
return str(compiled) % params
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Geometry(types.UserDefinedType[Any]):
|
|||||||
return f'GEOMETRY({self.subtype}, 4326)'
|
return f'GEOMETRY({self.subtype}, 4326)'
|
||||||
|
|
||||||
|
|
||||||
def bind_processor(self, dialect: sa.Dialect) -> Callable[[Any], str]:
|
def bind_processor(self, dialect: 'sa.Dialect') -> Callable[[Any], str]:
|
||||||
def process(value: Any) -> str:
|
def process(value: Any) -> str:
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
return 'SRID=4326;' + value
|
return 'SRID=4326;' + value
|
||||||
@@ -37,14 +37,14 @@ class Geometry(types.UserDefinedType[Any]):
|
|||||||
return process
|
return process
|
||||||
|
|
||||||
|
|
||||||
def result_processor(self, dialect: sa.Dialect, coltype: object) -> Callable[[Any], str]:
|
def result_processor(self, dialect: 'sa.Dialect', coltype: object) -> Callable[[Any], str]:
|
||||||
def process(value: Any) -> str:
|
def process(value: Any) -> str:
|
||||||
assert isinstance(value, str)
|
assert isinstance(value, str)
|
||||||
return value
|
return value
|
||||||
return process
|
return process
|
||||||
|
|
||||||
|
|
||||||
def bind_expression(self, bindvalue: sa.BindParameter[Any]) -> SaColumn:
|
def bind_expression(self, bindvalue: 'sa.BindParameter[Any]') -> SaColumn:
|
||||||
return sa.func.ST_GeomFromText(bindvalue, type_=self)
|
return sa.func.ST_GeomFromText(bindvalue, type_=self)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user