Skip to content

Commit

Permalink
chore: improve deprecation warning for ODBC drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
mortendaehli committed Sep 14, 2023
1 parent 0292214 commit e94d9b8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tagreader"
version = "4.3.1"
version = "4.3.2"
description = "Tagreader is a Python package for reading trend data from the OSIsoft PI and Aspen Infoplus.21 IMS systems."
authors = ["Einar S. Idsø <[email protected]>"]
license = "MIT"
Expand Down
14 changes: 10 additions & 4 deletions tagreader/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def list_sources(
auth: Optional[Any] = None,
verifySSL: bool = True,
) -> List[str]:
if imstype in [IMSType.ASPEN, IMSType.IP21]:
warnings.warn(
"ODBC based clients for ASPEN i deprecated and will be removed in the next release",
DeprecationWarning,
)
if isinstance(imstype, str):
try:
imstype = getattr(IMSType, imstype.upper())
Expand Down Expand Up @@ -212,6 +217,11 @@ def get_handler(
verifySSL: Optional[bool],
auth: Optional[Any],
):
if imstype in [IMSType.ASPEN, IMSType.IP21]:
warnings.warn(
"ODBC based clients for ASPEN i deprecated and will be removed in the next release",
DeprecationWarning,
)
if imstype is None:
try:
if datasource in list_aspenone_sources(
Expand Down Expand Up @@ -257,10 +267,6 @@ def get_handler(
"ODBC drivers not available for non-Windows environments. "
"Try Web API ('aspenone') instead."
)
warnings.warn(
"ODBC based clients for ASPEN i deprecated and will be removed in the next release",
DeprecationWarning,
)
if "AspenTech SQLplus" not in pyodbc.drivers():
raise RuntimeError(
"No Aspen SQLplus ODBC driver detected. "
Expand Down

0 comments on commit e94d9b8

Please sign in to comment.