This commit is contained in:
2025-08-27 21:11:48 +08:00
parent fe77c5869e
commit 695ec0b000
2490 changed files with 458653 additions and 11 deletions

View File

@@ -0,0 +1,36 @@
"""
Provides missing Postgresql types.
Use GeoAlchemy2 to support Postgis types.
Implement mockups for Point and LTree type, but generated models won't work out
of the box: a better way would be to use a package implementing proper classes
which could be imported in the target project.
"""
from sqlalchemy.dialects.postgresql.base import ischema_names, PGTypeCompiler
from sqlalchemy import types as sqltypes
try:
import geoalchemy2
except ImportError:
pass
class LTREE(sqltypes.TypeEngine):
"""Postgresql LTREE type mockup."""
__visit_name__ = 'LTREE'
class POINT(sqltypes.TypeEngine):
"""Postgresql POINT type mockup."""
__visit_name__ = 'POINT'
ischema_names['ltree'] = LTREE
ischema_names['point'] = POINT
PGTypeCompiler.visit_LTREE = lambda self, type_: 'LTREE'
PGTypeCompiler.visit_POINT = lambda self, type_: 'POINT'