Skip to content
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

Backport: Add Column Header to the exported CSV from query command #1354

Merged

Conversation

tlento
Copy link
Contributor

@tlento tlento commented Jul 26, 2024

This PR is a backport of #1313 to dbt-metricflow 0.7.x

This will allow us to deploy @saurabh0402's fix for the following issue:

#1285

Note - efficacy was tested via the CLI by running hatch build and doing a pip install
of the build package into a clean VM, and running mf query with the --csv flag
enabled.

# Issue
#1285

The CSV exported from the `mf query <metric> --csv <csv-file-name>`
command does not contain the column header. The CSV thus does not make
too much sense.

# Fix
- The code
[here](https://github.com/dbt-labs/metricflow/blob/main/dbt-metricflow/dbt_metricflow/cli/main.py#L344)
is writing data to the CSV file. The column names aren't getting added
to the file.
- With this PR, we are adding the column names returned from
`df.column_names` to the CSV to fix the issue.
@cla-bot cla-bot bot added the cla:yes label Jul 26, 2024
@tlento tlento changed the title Add Column Header to the exported CSV from query command (#1313) Backport: Add Column Header to the exported CSV from query command Jul 26, 2024
@tlento tlento changed the base branch from main to support/dbt-metricflow-0.7.x July 26, 2024 23:23
@tlento tlento marked this pull request as ready for review July 26, 2024 23:27
@tlento tlento merged commit 67508a8 into support/dbt-metricflow-0.7.x Jul 27, 2024
47 checks passed
@tlento tlento deleted the backport-cli-fix-dbt-metricflow-0.7.x branch July 27, 2024 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants