Skip to content

lightweight cli output update #3

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

Closed
wants to merge 2 commits into from

Conversation

leoebfolsom
Copy link

@leoebfolsom leoebfolsom commented Feb 2, 2023

My attempt at improving the CLI printout without using any additional python packages.

BEFORE:
Screenshot 2023-02-01 at 23 54 09

AFTER:
Screenshot 2023-02-01 at 23 52 48

@erezsh
Copy link

erezsh commented Feb 2, 2023

Looks like _get_stats_dbt() should instead just be a flag to _get_stats()

if k in diff_by_key:
assert sign != diff_by_key[k]
diff_by_key[k] = "!"
for i in range(0,len(extra_columns)):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to implement this using zip() / safezip()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip @erezsh that's new to me, I'll try it out.

@leoebfolsom
Copy link
Author

leoebfolsom commented Feb 2, 2023

@erezsh I'll try updating it to add a _get_stats() flag 👍

What do you suggest is the best way to determine that the --dbt flag was part of the data-diff command, so that I can apply if/then logic? In other words, within _get_stats_dbt():

if x:
  my updated output
else:
  the current output

What would x be?

@erezsh
Copy link

erezsh commented Feb 2, 2023

I don't understand the question. The flag exists in main, so it has to be passed along somehow.

@leoebfolsom
Copy link
Author

@erezsh ok, I'll figure it out and get back to you. I thought you might know off the top of your head how it is passed along.

@dlawin
Copy link
Owner

dlawin commented Feb 2, 2023

Could keep it simple and do something like:

def get_stats_string(self, is_dbt:bool = False):

In dbt.py:
diff.get_stats_string(is_dbt=True)

@dlawin
Copy link
Owner

dlawin commented Feb 2, 2023

Then there's no need to duplicate the logic in _get_stats()

You can add the additional functionality there and just wrap it in an if is_dbt:

@leoebfolsom
Copy link
Author

leoebfolsom commented Feb 2, 2023

Thanks @dlawin and @erezsh for the feedback. I need to sign off for a few and I'll be off on Friday and Monday, but I may get to at least some of this tonight. 🥳

@leoebfolsom leoebfolsom closed this Feb 9, 2023
dlawin pushed a commit that referenced this pull request Apr 20, 2023
Added main with repl command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants