aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-02 10:37:06 +0300
committerFrederick Muriuki Muriithi2023-08-02 10:37:06 +0300
commitce29a40618792b224fd0cc9bd6937c5fbee76c36 (patch)
tree2cfe3519c3c10fc43a5c6fa3c08d3f143d233069 /gn3
parent6fb63b348f77d4cce29278cf06191a11a3b6d95d (diff)
downloadgenenetwork3-ce29a40618792b224fd0cc9bd6937c5fbee76c36.tar.gz
Add deprecation notice to ORM-dependent `update` function
Add a deprecation notice to discourage other devs from using the deprecated `update` function.
Diffstat (limited to 'gn3')
-rw-r--r--gn3/db/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py
index 95b39d4..9a86ad8 100644
--- a/gn3/db/__init__.py
+++ b/gn3/db/__init__.py
@@ -1,5 +1,6 @@
# pylint: disable=[R0902, R0903]
"""Module that exposes common db operations"""
+import logging
from dataclasses import asdict, astuple
from typing import Any, Dict, List, Optional, Generator, Tuple, Union
from typing_extensions import Protocol
@@ -17,6 +18,8 @@ from gn3.db.phenotypes import phenotype_mapping
from gn3.db.phenotypes import publication_mapping
from gn3.db.phenotypes import publish_x_ref_mapping
+logger = logging.getLogger(__name__)
+
TABLEMAP = {
"Phenotype": phenotype_mapping,
@@ -45,6 +48,11 @@ def update(conn: Any,
data: Dataclass,
where: Dataclass) -> Optional[int]:
"""Run an UPDATE on a table"""
+ logger.warning(
+ "DEPRECATION WARNING: The function `%s.update` is deprecated and will "
+ "be removed soon. **DO NOT** use it, and remove all references to it "
+ "from your code.",
+ __name__)
if not (any(astuple(data)) and any(astuple(where))):
return None
data_ = {k: v for k, v in asdict(data).items()