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

Superset-4.1.0rc2: Download to CSV option is not showing up in SQL LAB page. #30204

Closed
3 tasks done
rabindragogoi opened this issue Sep 10, 2024 · 14 comments
Closed
3 tasks done
Labels
sqllab Namespace | Anything related to the SQL Lab

Comments

@rabindragogoi
Copy link

Bug description

In SqlLab the download to CSV option is not showing up to download the data. This option we can see in 3.0.0 version of superset but in 4.1.0rc2 it is not showing up even though I am assigned as an Admin user.

Screenshot: 4.1.0rc02:

image

Screenshot: 3.0.0:

image

@michael-s-molina @sadpandajoe : Is there any change in the UI for this functionality.?

How to reproduce the bug

In superset 4.0.1rc02.

Run a query in SQL LAB and check if you can see the download to csv option.

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.11

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented Sep 10, 2024

I found a similar issue that might be relevant to your problem: Excel export option missing in sql lab. This issue is closed and was last updated on June 28, 2024. It was referenced by a pull request that added the Excel export feature [1].

Regarding the "Download to CSV" option in Superset 4.1.0rc2, there have been changes in the UI. The "Download to CSV" functionality has been moved to a submenu under "Download" in the newer version. Here is the relevant code snippet:

{props.supersetCanCSV && (
  <Menu.SubMenu
    title={t('Download')}
    key={MenuKeys.Download}
    onTitleMouseEnter={() => setOpenKeys(undefined)}
  >
    <Menu.Item
      key={MenuKeys.ExportCsv}
      icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
    >
      {t('Export to .CSV')}
    </Menu.Item>
    {isPivotTable && (
      <Menu.Item
        key={MenuKeys.ExportPivotCsv}
        icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
      >
        {t('Export to Pivoted .CSV')}
      </Menu.Item>
    )}
    <Menu.Item
      key={MenuKeys.ExportXlsx}
      icon={<Icons.FileOutlined css={dropdownIconsStyles} />}
    >
      {t('Export to Excel')}
    </Menu.Item>
  </Menu.SubMenu>
)}

Additionally, ensure that the csv property is set to true, the user has the can_export_csv permission, and the ALLOW_FULL_CSV_EXPORT feature flag is appropriately configured. The relevant configuration settings are:

export interface ResultSetProps {
  ...
  csv?: boolean;
  ...
}

const ResultSet = ({
  ...
  csv = true,
  ...
}: ResultSetProps) => {
  ...
  const canExportData = findPermission(
    'can_export_csv',
    'SQLLab',
    user?.roles,
  );

  const renderControls = () => {
    if (search || visualize || csv) {
      ...
      return (
        <ResultSetControls>
          ...
          <ResultSetButtons>
            ...
            {csv && canExportData && (
              <Button
                buttonSize="small"
                href={getExportCsvUrl(query.id)}
                data-test="export-csv-button"
                onClick={() => logAction(LOG_ACTIONS_SQLLAB_DOWNLOAD_CSV, {})}
              >
                <i className="fa fa-file-text-o" /> {t('Download to CSV')}
              </Button>
            )}
            ...
          </ResultSetButtons>
          ...
        </ResultSetControls>
      );
    }
    return <div />;
  };
  ...
};

In the configuration file superset/config.py, the feature flag ALLOW_FULL_CSV_EXPORT can be set to control whether users are allowed to export full CSVs of table visualizations:

DEFAULT_FEATURE_FLAGS: dict[str, bool] = {
    ...
    "ALLOW_FULL_CSV_EXPORT": False,
    ...
}

Make sure these settings are correctly configured to enable the "Download to CSV" option [2][3][4].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Sep 10, 2024
@rabindragogoi
Copy link
Author

Hi @michael-s-molina , @sadpandajoe : The answer from @dosubot did not helped me here. As I mentioned this download to csv feature is working good in earlier version(3.0.0) of superset. I tried with both ALLOW_FULL_CSV_EXPORT as True and False (though earlier I kept it as false it is still working in 3.0.0), it is not working in 4.1.0rc02.

@sadpandajoe
Copy link
Member

@rabindragogoi does this work with 4.0.2? Trying to determine if this is a regression as part of 4.1.0rc2 or if it was broken between 3.0.0 and now.

@rabindragogoi
Copy link
Author

Hi @sadpandajoe : No it is not working in 4.0.2. Infact sql lab with presto database connection is not working in 4.0.2.

@michael-s-molina
Copy link
Member

Hi @sadpandajoe : No it is not working in 4.0.2. Infact sql lab with presto database connection is not working in 4.0.2.

@rabindragogoi I believe this is something with your deployment. You can access a test environment for 4.0.2 here and the Download to CSV option is available.

Screenshot 2024-09-11 at 14 17 36

@rabindragogoi
Copy link
Author

Hi @michael-s-molina : Trying with 4.0.2 will not work for me because in this version querying with presto database connection is showing error in SQLLab. I raised this issue earlier and thats why you asked me to try 4.1.0rc2.

Could you check if the download to csv is working in 4.1.0rc2 ?

@michael-s-molina
Copy link
Member

@rabindragogoi @sadpandajoe It's working for 4.0.2 but not working for 4.1.0RC2. It looks like the Download to CSV and Copy to Clipboard options are missing on 4.1.0RC2.

Screenshot 2024-09-12 at 08 17 18

@sadpandajoe This will be a blocker for the release as it's a regression from 4.0.2.

@michael-s-molina
Copy link
Member

Hi @michael-s-molina : Trying with 4.0.2 will not work for me because in this version querying with presto database connection is showing error in SQLLab. I raised this issue earlier and thats why you asked me to try 4.1.0rc2.

@rabindragogoi Just to confirm that this is working in 4.0.2 with a Presto connection.

Screenshot 2024-09-12 at 08 21 04

@rabindragogoi
Copy link
Author

Hi @michael-s-molina : Let me reverify once. I will update here.

@rabindragogoi
Copy link
Author

Hi @michael-s-molina : Yes. I am able to download data from Superset now .(Version 4.0.2). Issue was with my Flask-AppBuilder version. I was using Flask-AppBuilder==4.4.1. Now I am using Flask-AppBuilder==4.5.0. Which is working now.

@rabindragogoi
Copy link
Author

Issue closed

@michael-s-molina
Copy link
Member

@rabindragogoi I reopened the issue as it's happening on 4.1.0RC2.

@betodealmeida
Copy link
Member

I wasn't able to repro this — I checked out the tag 4.1.0rc2, rebuilt the assets with npm run build, started Trino on docker and it works for me:

Screenshot 2024-09-17 at 5 22 17 PM

Is this database-dependent? Should I use Presto instead of Trino?

@michael-s-molina
Copy link
Member

Thanks for checking this @betodealmeida. I was not able to reproduce either. Let's close this issue and reopen it if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

No branches or pull requests

4 participants