Skip to content

Commit

Permalink
Remove deprecated APIs for the next major release
Browse files Browse the repository at this point in the history
* schematools.utils was replaced by the loader API.
* is_relation_temporal was only used internally.
  • Loading branch information
vdboor committed Jul 11, 2024
1 parent 80094bb commit 2a59c64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 171 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Block `deepcopy()` of schema fields, as it's very slow.
* Removed `DatasetType` base class.
* Removed `schema import events` code, as its no longer used.
* Removed deprecated API's (`schematools.utils` and `is_relation_temporal`).
* Removed wirerope dependency.
* Removed Python 3.8 style annotations.

Expand Down
31 changes: 12 additions & 19 deletions src/schematools/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import re
import sys
import typing
import warnings
from collections import UserDict
from collections.abc import Iterator, Mapping
from enum import Enum
Expand Down Expand Up @@ -1720,7 +1719,18 @@ def is_through_table(self) -> bool:
or if the relation is temporal.
"""
return (
self.nm_relation is not None or self.relation_attributes or self.is_relation_temporal
self.nm_relation is not None
or self.relation_attributes
or (
# Uses a temporal relationship:
self.relation is not None
and (
# The "is_composite_key" check is a performance win,
# as that avoids having to fetch the related table object.
self.is_composite_key
or self.related_table.is_temporal
)
)
)

@cached_property
Expand All @@ -1742,23 +1752,6 @@ def through_table(self) -> DatasetTableSchema | None:
return None
return self._parent_table.dataset.build_through_table(field=self)

@cached_property
def is_relation_temporal(self):
"""Tell whether the 1-N relationship is modeled by an intermediate table.
This allows tracking multiple versions of the relationship.
"""
warnings.warn(
"Using `is_relation_temporal()` is deprecated, "
"use `self.related_table.is_temporal` instead.",
DeprecationWarning,
stacklevel=2,
)
# The "is_composite_key" check is a performance win,
# as that avoids having to fetch the related table object.
return self.relation is not None and (
self.is_composite_key or self.related_table.is_temporal
)

@cached_property
def auth(self) -> frozenset[str]:
"""Auth of the field, or OPENBAAR.
Expand Down
152 changes: 0 additions & 152 deletions src/schematools/utils.py

This file was deleted.

0 comments on commit 2a59c64

Please sign in to comment.