Skip to content

add commas #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions data_diff/diff_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import re
import time
import humanfriendly
from abc import ABC, abstractmethod
from enum import Enum
from contextlib import contextmanager
Expand Down Expand Up @@ -135,15 +136,22 @@ def _get_stats(self, is_dbt: bool = False) -> DiffStats:

return DiffStats(diff_by_sign, table1_count, table2_count, unchanged, diff_percent, extra_column_diffs)

def get_stats_string(self, is_dbt: bool = False):
diff_stats = self._get_stats(is_dbt)
def __init__(self, diff_by_sign, table1_count, table2_count, unchanged, diff_percent, extra_column_diffs=None):
self.diff_by_sign = diff_by_sign
self.table1_count = table1_count
self.table2_count = table2_count
self.unchanged = unchanged
self.diff_percent = diff_percent
self.extra_column_diffs = extra_column_diffs

def get_stats_string(self, is_dbt=False):
diff_stats = self._get_stats(is_dbt)
if is_dbt:
string_output = dbt_diff_string_template(
diff_stats.diff_by_sign["-"],
diff_stats.diff_by_sign["+"],
diff_stats.diff_by_sign["!"],
diff_stats.unchanged,
humanfriendly.format_number(diff_stats.diff_by_sign["-"]),
humanfriendly.format_number(diff_stats.diff_by_sign["+"]),
humanfriendly.format_number(diff_stats.diff_by_sign["!"]),
humanfriendly.format_number(diff_stats.unchanged),
diff_stats.extra_column_diffs,
"Values Updated:",
)
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://docs.readthedocs.io/en/stable/guides/specifying-dependencies.html#specifying-a-requirements-file
humanfriendly
sphinx-gallery
sphinx_markdown_tables
sphinx-copybutton
Expand Down