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

Commit 1e80aac

Browse files
authored
Merge pull request #216 from datafold/cleanup_aug26
Cleanup
2 parents 2b08d01 + b0c71b2 commit 1e80aac

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ If you pass `--stats` you'll see e.g. what % of rows were different.
476476

477477
data-diff collects anonymous usage data to help our team improve the tool and to apply development efforts to where our users need them most.
478478

479-
We capture two events, one when the data-diff run starts and one when it finished. No user data or potentially sensitive information is or ever will be collected. The captured data is limited to:
479+
We capture two events, one when the data-diff run starts and one when it is finished. No user data or potentially sensitive information is or ever will be collected. The captured data is limited to:
480480

481481
- Operating System and Python version
482482

data_diff/databases/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ def _parse_type(
154154
elif issubclass(cls, Decimal):
155155
if numeric_scale is None:
156156
numeric_scale = 0 # Needed for Oracle.
157-
# raise ValueError(
158-
# f"{self.name}: Unexpected numeric_scale is NULL, for column {'.'.join(table_path)}.{col_name} of type {type_repr}."
159-
# )
160157
return cls(precision=numeric_scale)
161158

162159
elif issubclass(cls, Float):
@@ -176,7 +173,8 @@ def select_table_schema(self, path: DbPath) -> str:
176173
schema, table = self._normalize_table_path(path)
177174

178175
return (
179-
"SELECT column_name, data_type, datetime_precision, numeric_precision, numeric_scale FROM information_schema.columns "
176+
"SELECT column_name, data_type, datetime_precision, numeric_precision, numeric_scale "
177+
"FROM information_schema.columns "
180178
f"WHERE table_name = '{table}' AND table_schema = '{schema}'"
181179
)
182180

data_diff/databases/presto.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def select_table_schema(self, path: DbPath) -> str:
8989
schema, table = self._normalize_table_path(path)
9090

9191
return (
92-
f"SELECT column_name, data_type, 3 as datetime_precision, 3 as numeric_precision FROM INFORMATION_SCHEMA.COLUMNS "
92+
"SELECT column_name, data_type, 3 as datetime_precision, 3 as numeric_precision "
93+
"FROM INFORMATION_SCHEMA.COLUMNS "
9394
f"WHERE table_name = '{table}' AND table_schema = '{schema}'"
9495
)
9596

data_diff/databases/snowflake.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ def __init__(self, *, schema: str, **kw):
3131
snowflake, serialization, default_backend = import_snowflake()
3232
logging.getLogger("snowflake.connector").setLevel(logging.WARNING)
3333

34-
# Got an error: snowflake.connector.network.RetryRequest: could not find io module state (interpreter shutdown?)
34+
# Ignore the error: snowflake.connector.network.RetryRequest: could not find io module state
3535
# It's a known issue: https://github.com/snowflakedb/snowflake-connector-python/issues/145
36-
# Found a quick solution in comments
3736
logging.getLogger("snowflake.connector.network").disabled = True
3837

3938
assert '"' not in schema, "Schema name should not contain quotes!"
40-
if (
41-
"key" in kw
42-
): # if private keys are used for Snowflake connection, read in key from path specified and pass as "private_key" to connector.
39+
# If a private key is used, read it from the specified path and pass it as "private_key" to the connector.
40+
if "key" in kw:
4341
with open(kw.get("key"), "rb") as key:
44-
if 'password' in kw:
42+
if "password" in kw:
4543
raise ConnectError("Cannot use password and key at the same time")
4644
p_key = serialization.load_pem_private_key(
4745
key.read(),

data_diff/tracking.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# This module contains all the functionality related to the anonymous tracking of data-diff use.
33
#
44

5-
import toml
65
import logging
76
import os
87
import json
@@ -12,6 +11,8 @@
1211
import urllib.request
1312
from uuid import uuid4
1413

14+
import toml
15+
1516
TRACK_URL = "https://api.perfalytics.com/track"
1617
START_EVENT = "os_diff_run_start"
1718
END_EVENT = "os_diff_run_end"
@@ -25,7 +26,7 @@ def _load_profile():
2526
try:
2627
with open(DEFAULT_PROFILE) as f:
2728
conf = toml.load(f)
28-
except FileNotFoundError as e:
29+
except FileNotFoundError:
2930
conf = {}
3031

3132
if "anonymous_id" not in conf:

0 commit comments

Comments
 (0)