Skip to content

Commit

Permalink
Restore CITEXT, Geoalchemy2 support (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
stavvy-rotte committed Aug 5, 2023
1 parent e823bc8 commit 67f12da
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ considered as tested only under a few environments) specify the ``citext`` extra
pip install sqlacodegen[citext]


To include support for the PostgreSQL ``GEOMETRY``, ``GEOGRAPHY``, and ``RASTER`` types (which should be
considered as tested only under a few environments) specify the ``geoalchemy2`` extra::
pip install sqlacodegen[geoalchemy2]



Quickstart
==========

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ sqlmodel = [
"sqlmodel",
]
citext = ["sqlalchemy-citext >= 1.7.0"]
geoalchemy2 = ["geoalchemy2 >= 0.11.1"]

[project.entry-points."sqlacodegen.generators"]
tables = "sqlacodegen.generators:TablesGenerator"
Expand Down
16 changes: 16 additions & 0 deletions src/sqlacodegen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
from sqlalchemy.engine import create_engine
from sqlalchemy.schema import MetaData

try:
import citext
except ImportError:
citext = None

try:
import geoalchemy2
except ImportError:
geoalchemy2 = None

if sys.version_info < (3, 10):
from importlib_metadata import entry_points, version
else:
Expand Down Expand Up @@ -50,6 +60,12 @@ def main() -> None:
parser.print_help()
return

if citext:
print(f"Using sqlalchemy-citext {citext.__version__}")

if geoalchemy2:
print(f"Using geoalchemy2 {geoalchemy2.__version__}")

# Use reflection to fill in the metadata
engine = create_engine(args.url)
metadata = MetaData()
Expand Down

0 comments on commit 67f12da

Please sign in to comment.