Skip to content

Commit

Permalink
Update the CLI to use corresponding methods for the data table.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed May 31, 2024
1 parent 7d15c96 commit c5e8281
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dbt-metricflow/dbt_metricflow/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,14 @@ def query(
df = query_result.result_df
# Show the data if returned successfully
if df is not None:
if df.empty:
if df.row_count == 0:
click.echo("🕳 Successful MQL query returned an empty result set.")
elif csv is not None:
# csv is a LazyFile that is file-like that works in this case.
df.to_csv(csv, index=False) # type: ignore
click.echo(f"🖨 Successfully written query output to {csv.name}")
else:
click.echo(df.to_markdown(index=False, floatfmt=f".{decimals}f"))
click.echo(df.text_format(decimals))

if display_plans:
temp_path = tempfile.mkdtemp()
Expand Down

0 comments on commit c5e8281

Please sign in to comment.