Skip to content

Commit 11433a3

Browse files
authored
chore: remove deprecated helpers (#789)
1 parent 5e30814 commit 11433a3

2 files changed

Lines changed: 0 additions & 50 deletions

File tree

diracx-db/src/diracx/db/sql/utils/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
__all__ = [
44
"_get_columns",
55
"utcnow",
6-
"Column",
7-
"NullColumn",
8-
"DateNowColumn",
96
"BaseSQLDB",
107
"EnumBackedBool",
11-
"EnumColumn",
128
"enum_column",
139
"apply_search_filters",
1410
"apply_sort_constraints",
@@ -37,11 +33,7 @@
3733
)
3834
from .functions import hash, substract_date, utcnow
3935
from .types import (
40-
Column,
41-
DateNowColumn,
4236
EnumBackedBool,
43-
EnumColumn,
44-
NullColumn,
4537
datetime_now,
4638
enum_column,
4739
str32,

diracx-db/src/diracx/db/sql/utils/types.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,15 @@
11
from __future__ import annotations
22

3-
import warnings
43
from datetime import datetime
5-
from functools import partial
64
from zoneinfo import ZoneInfo
75

86
import sqlalchemy.types as types
9-
from sqlalchemy import Column as RawColumn
107
from sqlalchemy import DateTime, Enum
118
from sqlalchemy.orm import mapped_column
129
from typing_extensions import Annotated
1310

1411
from .functions import utcnow
1512

16-
17-
def _deprecated(name: str, replacement: str):
18-
warnings.warn(
19-
f"{name} is deprecated and will be removed in a future major release. "
20-
f"Use {replacement} instead.",
21-
DeprecationWarning,
22-
stacklevel=3,
23-
)
24-
25-
26-
_Column: partial[RawColumn] = partial(RawColumn, nullable=False)
27-
28-
29-
def Column(*args, **kwargs): # noqa: N802
30-
_deprecated("Column", "Mapped[...] + mapped_column(...)")
31-
return _Column(*args, **kwargs)
32-
33-
34-
_NullColumn: partial[RawColumn] = partial(RawColumn, nullable=True)
35-
36-
37-
def NullColumn(*args, **kwargs): # noqa: N802
38-
_deprecated("NullColumn", "Mapped[Optional[...]] + mapped_column(...)")
39-
return _NullColumn(*args, **kwargs)
40-
41-
42-
_DateNowColumn = partial(Column, type_=DateTime(timezone=True), server_default=utcnow())
43-
44-
45-
def DateNowColumn(*args, **kwargs): # noqa: N802
46-
_deprecated("DateNowColumn", "Mapped[datetime_now] + mapped_column(...)")
47-
return _DateNowColumn(*args, **kwargs)
48-
49-
5013
# Module-level constants for default timezone values
5114
_DEFAULT_UTC = ZoneInfo("UTC")
5215

@@ -62,11 +25,6 @@ def DateNowColumn(*args, **kwargs): # noqa: N802
6225
str1024 = Annotated[str, 1024]
6326

6427

65-
def EnumColumn(name, enum_type, **kwargs): # noqa: N802
66-
_deprecated("EnumColumn", "Mapped[...] + enum_column(...)")
67-
return Column(name, Enum(enum_type, native_enum=False, length=16), **kwargs)
68-
69-
7028
def enum_column(name, enum_type, **kwargs):
7129
return mapped_column(name, Enum(enum_type, native_enum=False, length=16), **kwargs)
7230

0 commit comments

Comments
 (0)