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

Downloaded CSV/JSON for a customized table contains all columns #3992

Closed
jgoclawski opened this issue Dec 21, 2016 · 9 comments
Closed

Downloaded CSV/JSON for a customized table contains all columns #3992

jgoclawski opened this issue Dec 21, 2016 · 9 comments

Comments

@jgoclawski
Copy link

  • Your browser and the version: Google Chrome 54
  • Your operating system: Ubuntu 16.04
  • Your databases: Postgres, H2 (demo)
  • Metabase version: 0.21.0
  • Metabase hosting environment: Docker
  • Metabase internal database: Postgres

Repeatable steps to reproduce the issue:

  1. Ask any question
  2. Display it as table.
  3. Click "cog" icon to show preferences for table visualization.
  4. A "Customize this table" modal will be shown.
  5. Uncheck a few checkboxes in "Fields to include"
  6. Click "Done".
  7. Observe that the table has only those columns left checked in step 5, e.g "ID", "Total"
  8. Click download icon.
  9. Select CSV or JSON (doesn't matter)
  10. Observe that downloaded file contains all the columns, not only those left checked in step 5.

I'm attaching 2 screenshots.
metabase_customize_table
metabase_download_csv

The resulting CSV file starts with:

ID,CREATED_AT,PRODUCT_ID,SUBTOTAL,TAX,TOTAL,USER_ID
1,2016-05-28T16:08:40.953Z,141,12.65,0.0,12.65,2
2,2016-08-27T23:41:37.372Z,173,54.8,0.0,54.8,2
3,2016-08-19T22:01:27.966Z,140,29.88,0.0,29.88,2
4,2017-01-19T13:22:38.527Z,196,17.97,0.0,17.97,2
5,2017-03-26T07:12:11.671Z,68,18.1,0.0,18.1,2
@tlrobinson
Copy link
Contributor

Yeah, this is definitely confusing. The chart settings are all client-side display settings, while the CSV download just downloads the raw query. Same issue with pivoting: #2473

@tanzoniteblack
Copy link
Contributor

Do you think this would be solvable if we update the question to write the query such that it only requested from the backend the queries desired to be viewed, and respected the order returned from the backend?

That would potentially solve both this exact problem and another related one I'm having where the order of columns isn't being respected in the download.

If you guys don't have time to do this, but are ok with the approach that I just suggested, then let me know and I'll give it a stab.

@tlrobinson
Copy link
Contributor

@tanzoniteblack Yeah I think basically syncing the columns in the display settings with the query would be a good approach, as it would also reduce the amount of data that needs to be fetched.

Related to that I started on a PR awhile ago that allowed you add new columns to a query: #3043

@Serfenia
Copy link

I really like this enhancement to be added. Thumbs up!

@csawyerYumaed
Copy link

This seems very much related to #5295 (XLSX)
and I hope order would be preserved as well.

@kreno
Copy link

kreno commented Oct 27, 2017

Yes, please. The export isn't much good to our users if it is different than the settings on the screen.

@tashiritzy
Copy link

If you use Grouped By option instead of selecting the fields from the check list, it serves some purpose.

@tlrobinson
Copy link
Contributor

As of v0.30.0 if you hide columns in the visualization settings the visible columns are synced to the query itself, which will be reflected in the download.

There are still some differences in what's displayed vs download (e.x. pivoting) but I think they're covered by other issues, so I'm going to close this.

@tlrobinson
Copy link
Contributor

(Note that existing questions aren't updated automatically, you will have to modify the visible columns, close the visualization settings for them to be updated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants