Skip to content

Commit

Permalink
support separation of Numeric/Float
Browse files Browse the repository at this point in the history
in [1] we are considering separating Numeric and Float.
For Alembic PostgreSQL backend we need this isinstance therefore
to check for both Numeric and Float.
By keeping it to these two types, rather than targeting the
NumericCommon type being added in [1], the patch can work with
SQLAlchemy without the separation change as well.

[1] https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3587

Change-Id: I0c956ba8797e38a62ea630ab65cd53779bbf1972
  • Loading branch information
zzzeek committed Nov 25, 2024
1 parent e09ef30 commit 3815c57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion alembic/ddl/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import Union

from sqlalchemy import Column
from sqlalchemy import Float
from sqlalchemy import literal_column
from sqlalchemy import Numeric
from sqlalchemy import text
Expand Down Expand Up @@ -132,7 +133,7 @@ def compare_server_default(
metadata_default = metadata_column.server_default.arg

if isinstance(metadata_default, str):
if not isinstance(inspector_column.type, Numeric):
if not isinstance(inspector_column.type, (Numeric, Float)):
metadata_default = re.sub(r"^'|'$", "", metadata_default)
metadata_default = f"'{metadata_default}'"

Expand Down

0 comments on commit 3815c57

Please sign in to comment.