Skip to content

Commit

Permalink
Tighten up type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
ximenesuk committed Sep 14, 2023
1 parent e17e983 commit 1eaf85b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions etlhelper/etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
from typing import (
Any,
Callable,
Collection,
Iterable,
Iterator,
NamedTuple,
Optional,
Union,
)

from etlhelper.abort import (
Expand Down Expand Up @@ -335,7 +335,7 @@ def _execute_by_row(
:returns failed_rows: list of (row, exception) tuples
"""
FailedRow = namedtuple('FailedRow', 'row, exception')
failed_rows = []
failed_rows: list[NamedTuple] = []

for row in chunk:
try:
Expand Down Expand Up @@ -406,7 +406,7 @@ def copy_rows(
def execute(
query: str,
conn: Connection,
parameters: Union[tuple, dict] = ()
parameters: Collection[Any] = ()
) -> None:
"""
Run SQL query against connection.
Expand Down Expand Up @@ -491,7 +491,7 @@ def copy_table_rows(
def load(
table: str,
conn: Connection,
rows: Iterator,
rows: Iterable[Row],
transform: Optional[Callable[[Chunk], Chunk]] = None,
on_error: Optional[Callable] = None,
commit_chunks: bool = True,
Expand Down Expand Up @@ -558,7 +558,7 @@ def load(

def generate_insert_sql(
table: str,
row: Union[NamedTuple, dict],
row: Row,
conn: Connection
) -> str:
"""Generate insert SQL for table, getting column names from row and the
Expand Down

0 comments on commit 1eaf85b

Please sign in to comment.