diff options
author | BonfaceKilz | 2021-07-10 09:24:41 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-07-10 09:24:41 +0300 |
commit | 7d22039c2ae0aef6abc575008f11b95e555e3e9a (patch) | |
tree | 5fe5cd9f3deedc6bbc56bed109ab2d3a09cf7332 /gn3/db | |
parent | b08443da699a2d929657fad4fdee431a2b277e7e (diff) | |
download | genenetwork3-7d22039c2ae0aef6abc575008f11b95e555e3e9a.tar.gz |
gn3: db: Use correct type for columns arg in fetch functions
Diffstat (limited to 'gn3/db')
-rw-r--r-- | gn3/db/__init__.py | 6 |
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 |