Skip to content

Commit

Permalink
Refine message hint
Browse files Browse the repository at this point in the history
Signed-off-by: Wei-Chun, Chang <[email protected]>
  • Loading branch information
wcchang1115 committed Sep 1, 2023
1 parent 1cd6099 commit ac08909
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion piperider_cli/dbtutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def get_dbt_state_metrics_16(dbt_state_dir: str, dbt_tag: str, dbt_resources: Op
manifest = _get_state_manifest(dbt_state_dir)

if not is_dbt_schema_version_16(manifest):
console.print('Metric is not supported for dbt version < 0.16')
console.print("[[bold yellow]Skip[/bold yellow]] Metric query is not supported for dbt metric < 1.6")
return []

def is_chosen(key, metric):
Expand Down
6 changes: 3 additions & 3 deletions piperider_cli/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,12 @@ def filter_fn(subject: ProfileSubject):
raise Exception(f'Profiler Exception: {type(e).__name__}(\'{e}\')')

statistics.reset()
metrics = []
if dbt_config:
metrics = dbtutil.get_dbt_state_metrics_16(dbt_target_path, dbt_config.get('tag'), dbt_resources)

if skip_datasource_connection is False:
console.rule('Query metrics')
metrics = []
if dbt_config:
metrics = dbtutil.get_dbt_state_metrics_16(dbt_target_path, dbt_config.get('tag'), dbt_resources)
statistics.display_statistic('query', 'metric')
if metrics:
run_result['metrics'] = MetricEngine(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_dbt_util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
from pathlib import Path
from unittest import TestCase, mock
from unittest import TestCase, mock, skip

import piperider_cli.dbtutil as dbtutil
from piperider_cli.datasource.sqlite import SqliteDataSource
Expand Down Expand Up @@ -196,6 +196,7 @@ def test_dbt_append_descriptions(self):
self.assertEqual('The symbol name',
profile_results['tables']['PRICE_PRESENT']['columns']['symbol']['description'])

@skip("deprecated after v0.33.0, skipping")
def test_get_dbt_state_metrics_only_tag(self):
metrics = dbtutil.get_dbt_state_metrics(self.dbt_state_dir, 'piperider', None)

Expand All @@ -206,6 +207,7 @@ def test_get_dbt_state_metrics_only_tag(self):
self.assertEqual(len(metrics), 1)
self.assertEqual(metrics[0].name, 'active_projects_per_user')

@skip("deprecated after v0.33.0, skipping")
def test_get_dbt_state_metrics_only_resources(self):
metrics = ['metric.infusetude.active_projects',
'metric.infusetude.active_projects_per_user',
Expand Down

0 comments on commit ac08909

Please sign in to comment.