From 79c25afac4c9de9cf5da326c74f6d315e1bca804 Mon Sep 17 00:00:00 2001 From: Idan Sheinberg Date: Sat, 11 Jan 2025 19:25:36 +0200 Subject: [PATCH] Update src/sqlacodegen/generators.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alex Grönholm --- src/sqlacodegen/generators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sqlacodegen/generators.py b/src/sqlacodegen/generators.py index fe37cef..6049718 100644 --- a/src/sqlacodegen/generators.py +++ b/src/sqlacodegen/generators.py @@ -1385,6 +1385,7 @@ def collect_imports(self, models: Iterable[Model]) -> None: super(DeclarativeGenerator, self).collect_imports(models) if any(isinstance(model, Model) for model in models): self.add_literal_import("sqlalchemy", "MetaData") + if any(isinstance(model, ModelClass) for model in models): self.add_literal_import("sqlmodel", "SQLModel") self.add_literal_import("sqlmodel", "Field")