aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-07-10 09:24:41 +0300
committerBonfaceKilz2021-07-10 09:24:41 +0300
commit7d22039c2ae0aef6abc575008f11b95e555e3e9a (patch)
tree5fe5cd9f3deedc6bbc56bed109ab2d3a09cf7332
parentb08443da699a2d929657fad4fdee431a2b277e7e (diff)
downloadgenenetwork3-7d22039c2ae0aef6abc575008f11b95e555e3e9a.tar.gz
gn3: db: Use correct type for columns arg in fetch functions
-rw-r--r--gn3/db/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/gn3/db/__init__.py b/gn3/db/__init__.py
index afc8897..5ab9f3c 100644
--- a/gn3/db/__init__.py
+++ b/gn3/db/__init__.py
@@ -1,7 +1,7 @@
# pylint: disable=[R0902, R0903]
"""Module that exposes common db operations"""
from dataclasses import asdict, astuple
-from typing import Any, Dict, List, Optional, Generator
+from typing import Any, Dict, List, Optional, Generator, Union
from typing_extensions import Protocol
from gn3.db.metadata_audit import MetadataAudit
@@ -67,7 +67,7 @@ def update(conn: Any,
def fetchone(conn: Any,
table: str,
where: Optional[Dataclass],
- columns: Optional[List[str]] = "*") -> Optional[Dataclass]:
+ columns: Union[str, List[str]] = "*") -> Optional[Dataclass]:
"""Run a SELECT on a table. Returns only one result!"""
if not any(astuple(where)):
return None
@@ -90,7 +90,7 @@ def fetchone(conn: Any,
def fetchall(conn: Any,
table: str,
where: Optional[Dataclass],
- columns: Optional[List[str]] = "*") -> Optional[Generator]:
+ columns: Union[str, List[str]] = "*") -> Optional[Generator]:
"""Run a SELECT on a table. Returns all the results as a tuple!"""
if not any(astuple(where)):
return None