Skip to content

Commit 08e3a27

Browse files
committed
fix: handle python type for Postgres TSVECTOR
1 parent f41d8b4 commit 08e3a27

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/sqlacodegen/generators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
TypeDecorator,
3939
UniqueConstraint,
4040
)
41-
from sqlalchemy.dialects.postgresql import DOMAIN, JSON, JSONB
41+
from sqlalchemy.dialects.postgresql import DOMAIN, JSON, JSONB, TSVECTOR
4242
from sqlalchemy.engine import Connection, Engine
4343
from sqlalchemy.exc import CompileError
4444
from sqlalchemy.sql.elements import TextClause
@@ -1242,6 +1242,8 @@ def get_type_qualifiers() -> tuple[str, TypeEngine[Any], str]:
12421242
def render_python_type(column_type: TypeEngine[Any]) -> str:
12431243
if isinstance(column_type, DOMAIN):
12441244
python_type = column_type.data_type.python_type
1245+
elif isinstance(column_type, TSVECTOR):
1246+
python_type = str
12451247
else:
12461248
python_type = column_type.python_type
12471249

0 commit comments

Comments
 (0)