Skip to content

Commit 67f12da

Browse files
authored
Restore CITEXT, Geoalchemy2 support (#206)
1 parent e823bc8 commit 67f12da

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ considered as tested only under a few environments) specify the ``citext`` extra
4141
pip install sqlacodegen[citext]
4242

4343

44+
To include support for the PostgreSQL ``GEOMETRY``, ``GEOGRAPHY``, and ``RASTER`` types (which should be
45+
considered as tested only under a few environments) specify the ``geoalchemy2`` extra::
46+
pip install sqlacodegen[geoalchemy2]
47+
48+
49+
4450
Quickstart
4551
==========
4652

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ sqlmodel = [
5151
"sqlmodel",
5252
]
5353
citext = ["sqlalchemy-citext >= 1.7.0"]
54+
geoalchemy2 = ["geoalchemy2 >= 0.11.1"]
5455

5556
[project.entry-points."sqlacodegen.generators"]
5657
tables = "sqlacodegen.generators:TablesGenerator"

src/sqlacodegen/cli.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88
from sqlalchemy.engine import create_engine
99
from sqlalchemy.schema import MetaData
1010

11+
try:
12+
import citext
13+
except ImportError:
14+
citext = None
15+
16+
try:
17+
import geoalchemy2
18+
except ImportError:
19+
geoalchemy2 = None
20+
1121
if sys.version_info < (3, 10):
1222
from importlib_metadata import entry_points, version
1323
else:
@@ -50,6 +60,12 @@ def main() -> None:
5060
parser.print_help()
5161
return
5262

63+
if citext:
64+
print(f"Using sqlalchemy-citext {citext.__version__}")
65+
66+
if geoalchemy2:
67+
print(f"Using geoalchemy2 {geoalchemy2.__version__}")
68+
5369
# Use reflection to fill in the metadata
5470
engine = create_engine(args.url)
5571
metadata = MetaData()

0 commit comments

Comments
 (0)