Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 1a86c58

Browse files
authored
Merge pull request #267 from datafold/oct31_tiny_cleanup
Tiny Cleanup
2 parents b75b1c9 + 5716aee commit 1a86c58

File tree

8 files changed

+15
-16
lines changed

8 files changed

+15
-16
lines changed

data_diff/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def __init__(self, **kwargs):
6565
self.indent_increment = 6
6666

6767
def write_usage(self, prog: str, args: str = "", prefix: Optional[str] = None) -> None:
68-
self.write(f"data-diff - efficiently diff rows across database tables.\n\n")
69-
self.write(f"Usage:\n")
68+
self.write("data-diff - efficiently diff rows across database tables.\n\n")
69+
self.write("Usage:\n")
7070
self.write(f" * In-db diff: {prog} <database1> <table1> <table2> [OPTIONS]\n")
7171
self.write(f" * Cross-db diff: {prog} <database1> <table1> <database2> <table2> [OPTIONS]\n")
7272
self.write(f" * Using config: {prog} --conf PATH [--run NAME] [OPTIONS]\n")

data_diff/databases/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def query(self, sql_ast: Union[Expr, Generator], res_type: type = list):
143143
(row,) = row
144144
logger.debug("EXPLAIN: %s", row)
145145
answer = input("Continue? [y/n] ")
146-
if not answer.lower() in ["y", "yes"]:
146+
if answer.lower() not in ["y", "yes"]:
147147
sys.exit(1)
148148

149149
res = self._query(sql_code)
@@ -310,9 +310,9 @@ def offset_limit(self, offset: Optional[int] = None, limit: Optional[int] = None
310310

311311
return f"LIMIT {limit}"
312312

313-
def concat(self, l: List[str]) -> str:
314-
assert len(l) > 1
315-
joined_exprs = ", ".join(l)
313+
def concat(self, items: List[str]) -> str:
314+
assert len(items) > 1
315+
joined_exprs = ", ".join(items)
316316
return f"concat({joined_exprs})"
317317

318318
def is_distinct_from(self, a: str, b: str) -> str:

data_diff/databases/database_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def quote(self, s: str):
151151
...
152152

153153
@abstractmethod
154-
def concat(self, l: List[str]) -> str:
154+
def concat(self, items: List[str]) -> str:
155155
"Provide SQL for concatenating a bunch of columns into a string"
156156
...
157157

data_diff/databases/oracle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def offset_limit(self, offset: Optional[int] = None, limit: Optional[int] = None
127127

128128
return f"FETCH NEXT {limit} ROWS ONLY"
129129

130-
def concat(self, l: List[str]) -> str:
131-
joined_exprs = " || ".join(l)
130+
def concat(self, items: List[str]) -> str:
131+
joined_exprs = " || ".join(items)
132132
return f"({joined_exprs})"
133133

134134
def timestamp_value(self, t: DbTime) -> str:

data_diff/databases/redshift.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def normalize_timestamp(self, value: str, coltype: TemporalType) -> str:
3636
def normalize_number(self, value: str, coltype: FractionalType) -> str:
3737
return self.to_string(f"{value}::decimal(38,{coltype.precision})")
3838

39-
def concat(self, l: List[str]) -> str:
40-
joined_exprs = " || ".join(l)
39+
def concat(self, items: List[str]) -> str:
40+
joined_exprs = " || ".join(items)
4141
return f"({joined_exprs})"
4242

4343
def select_table_schema(self, path: DbPath) -> str:

data_diff/databases/vertica.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def select_table_schema(self, path: DbPath) -> str:
9999
def quote(self, s: str):
100100
return f'"{s}"'
101101

102-
def concat(self, l: List[str]) -> str:
103-
return " || ".join(l)
102+
def concat(self, items: List[str]) -> str:
103+
return " || ".join(items)
104104

105105
def md5_to_int(self, s: str) -> str:
106106
return f"CAST(HEX_TO_INTEGER(SUBSTRING(MD5({s}), {1 + MD5_HEXDIGITS - CHECKSUM_HEXDIGITS})) AS NUMERIC(38, 0))"

data_diff/joindiff_tables.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
"""
44

5-
from contextlib import suppress
65
from decimal import Decimal
76
from functools import partial
87
import logging
@@ -21,7 +20,7 @@
2120
from .diff_tables import TableDiffer, DiffResult
2221
from .thread_utils import ThreadedYielder
2322

24-
from .queries import table, sum_, min_, max_, avg, commit
23+
from .queries import table, sum_, min_, max_, avg
2524
from .queries.api import and_, if_, or_, outerjoin, leftjoin, rightjoin, this, ITable
2625
from .queries.ast_classes import Concat, Count, Expr, Random, TablePath
2726
from .queries.compiler import Compiler

data_diff/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import math
44
from typing import Iterable, Iterator, MutableMapping, Union, Any, Sequence, Dict
55
from typing import TypeVar
6-
from abc import ABC, abstractmethod
6+
from abc import abstractmethod
77
from urllib.parse import urlparse
88
from uuid import UUID
99
import operator

0 commit comments

Comments
 (0)