-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from elementary-data/empty_state_and_metrics
Empty state and metrics
- Loading branch information
Showing
9 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
|
||
class EmptyGraphHelper(object): | ||
def __init__(self, platform_type): | ||
self._platform_type = platform_type | ||
|
||
def get_integration_docs_link(self): | ||
if self._platform_type == 'snowflake': | ||
return "https://docs.elementary-data.com/integrations/snowflake" | ||
elif self._platform_type == 'bigquery': | ||
return "https://docs.elementary-data.com/integrations/bigquery" | ||
else: | ||
return "https://docs.elementary-data.com/guides/usage/query-history-1" | ||
|
||
def get_help_message(self): | ||
return f""" | ||
We are deeply sorry but unfortunately the result graph is empty. | ||
Please try the following steps to fix the problem - | ||
\t1. Try running again with --ignore-schema=true | ||
\t2. Check that you have sufficient permissions (follow this short guide here - {self.get_integration_docs_link()}) | ||
\t3. Join our slack channel here - https://bit.ly/slack-elementary, we promise to help and be nice! | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from collections import defaultdict | ||
from lineage.query_context import QueryContext | ||
|
||
|
||
class QueryHistoryStats(object): | ||
def __init__(self): | ||
self._query_type_stats = defaultdict(lambda: 0) | ||
self._roles = set() | ||
self._users = set() | ||
|
||
def update_stats(self, query_context: QueryContext): | ||
if query_context.query_type is not None: | ||
self._query_type_stats[query_context.query_type] += 1 | ||
|
||
if query_context.user_name is not None: | ||
self._users.add(query_context.user_name) | ||
|
||
if query_context.role_name is not None: | ||
self._users.add(query_context.role_name) | ||
|
||
def to_dict(self): | ||
query_history_stats_dict = self._query_type_stats.copy() | ||
query_history_stats_dict['user_count'] = len(self._users) | ||
query_history_stats_dict['role_count'] = len(self._roles) | ||
return query_history_stats_dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters