Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions alembic/ddl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
from sqlalchemy import Identity
from sqlalchemy.sql.compiler import Compiled
from sqlalchemy.sql.compiler import DDLCompiler
from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy.sql.elements import TextClause
from sqlalchemy.sql.functions import Function
from sqlalchemy.sql.schema import FetchedValue
from sqlalchemy.sql.type_api import TypeEngine

from .impl import DefaultImpl

_ServerDefault = Union["TextClause", "FetchedValue", "Function[Any]", str]
_ServerDefault = Union["FetchedValue", str, "TextClause", "ColumnElement[Any]"]


class AlterTable(DDLElement):
Expand Down
7 changes: 3 additions & 4 deletions alembic/op.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ if TYPE_CHECKING:
from sqlalchemy.sql.expression import TableClause
from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.schema import Computed
from sqlalchemy.sql.schema import FetchedValue
from sqlalchemy.sql.schema import Identity
from sqlalchemy.sql.schema import SchemaItem
from sqlalchemy.sql.schema import Table
Expand Down Expand Up @@ -154,14 +155,12 @@ def alter_column(
*,
nullable: Optional[bool] = None,
comment: Union[str, Literal[False], None] = False,
server_default: Union[
str, bool, Identity, Computed, TextClause, None
] = False,
server_default: Union["FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]] = False,
new_column_name: Optional[str] = None,
type_: Union[TypeEngine[Any], Type[TypeEngine[Any]], None] = None,
existing_type: Union[TypeEngine[Any], Type[TypeEngine[Any]], None] = None,
existing_server_default: Union[
str, bool, Identity, Computed, TextClause, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
Expand Down
11 changes: 7 additions & 4 deletions alembic/operations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from sqlalchemy.sql.expression import TextClause
from sqlalchemy.sql.schema import Column
from sqlalchemy.sql.schema import Computed
from sqlalchemy.sql.schema import FetchedValue
from sqlalchemy.sql.schema import Identity
from sqlalchemy.sql.schema import SchemaItem
from sqlalchemy.types import TypeEngine
Expand Down Expand Up @@ -711,15 +712,15 @@ def alter_column(
nullable: Optional[bool] = None,
comment: Union[str, Literal[False], None] = False,
server_default: Union[
str, bool, Identity, Computed, TextClause, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
new_column_name: Optional[str] = None,
type_: Union[TypeEngine[Any], Type[TypeEngine[Any]], None] = None,
existing_type: Union[
TypeEngine[Any], Type[TypeEngine[Any]], None
] = None,
existing_server_default: Union[
str, bool, Identity, Computed, TextClause, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
Expand Down Expand Up @@ -1678,14 +1679,16 @@ def alter_column(
*,
nullable: Optional[bool] = None,
comment: Union[str, Literal[False], None] = False,
server_default: Any = False,
server_default: Union[
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
new_column_name: Optional[str] = None,
type_: Union[TypeEngine[Any], Type[TypeEngine[Any]], None] = None,
existing_type: Union[
TypeEngine[Any], Type[TypeEngine[Any]], None
] = None,
existing_server_default: Union[
str, bool, Identity, Computed, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
Expand Down
8 changes: 6 additions & 2 deletions alembic/operations/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@

from sqlalchemy.engine import Dialect
from sqlalchemy.sql.elements import ColumnClause
from sqlalchemy.sql.elements import ColumnElement
from sqlalchemy.sql.elements import TextClause
from sqlalchemy.sql.elements import quoted_name
from sqlalchemy.sql.functions import Function
from sqlalchemy.sql.schema import Constraint
from sqlalchemy.sql.schema import FetchedValue
from sqlalchemy.sql.type_api import TypeEngine

from ..ddl.impl import DefaultImpl
Expand Down Expand Up @@ -485,7 +487,9 @@ def alter_column(
table_name: str,
column_name: str,
nullable: Optional[bool] = None,
server_default: Optional[Union[Function[Any], str, bool]] = False,
server_default: Union[
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
name: Optional[str] = None,
type_: Optional[TypeEngine] = None,
autoincrement: Optional[Union[bool, Literal["auto"]]] = None,
Expand Down
17 changes: 11 additions & 6 deletions alembic/operations/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from sqlalchemy.sql.schema import Constraint
from sqlalchemy.sql.schema import ForeignKeyConstraint
from sqlalchemy.sql.schema import Identity
from sqlalchemy.sql.schema import FetchedValue
from sqlalchemy.sql.schema import Index
from sqlalchemy.sql.schema import MetaData
from sqlalchemy.sql.schema import PrimaryKeyConstraint
Expand Down Expand Up @@ -1696,7 +1697,9 @@ def __init__(
*,
schema: Optional[str] = None,
existing_type: Optional[Any] = None,
existing_server_default: Any = False,
existing_server_default: Union[
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
modify_nullable: Optional[bool] = None,
Expand Down Expand Up @@ -1856,15 +1859,15 @@ def alter_column(
nullable: Optional[bool] = None,
comment: Optional[Union[str, Literal[False]]] = False,
server_default: Union[
str, bool, Identity, Computed, TextClause, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
new_column_name: Optional[str] = None,
type_: Optional[Union[TypeEngine[Any], Type[TypeEngine[Any]]]] = None,
existing_type: Optional[
Union[TypeEngine[Any], Type[TypeEngine[Any]]]
] = None,
existing_server_default: Union[
str, bool, Identity, Computed, TextClause, None
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
Expand Down Expand Up @@ -1980,14 +1983,16 @@ def batch_alter_column(
*,
nullable: Optional[bool] = None,
comment: Optional[Union[str, Literal[False]]] = False,
server_default: Any = False,
server_default: Union[
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
new_column_name: Optional[str] = None,
type_: Optional[Union[TypeEngine[Any], Type[TypeEngine[Any]]]] = None,
existing_type: Optional[
Union[TypeEngine[Any], Type[TypeEngine[Any]]]
] = None,
existing_server_default: Optional[
Union[str, bool, Identity, Computed]
existing_server_default: Union[
"FetchedValue", str, "TextClause", "ColumnElement[Any]", None, Literal[False]
] = False,
existing_nullable: Optional[bool] = None,
existing_comment: Optional[str] = None,
Expand Down