Bug description

I got an error message chart limit when creating a chart from sqllab:

The row limit set for the chart was reached. The chart may show partial data.

How to reproduce the bug

Create a chart from sqllab.

Screenshots/recordings

Apache Superset The row limit set for the chart was reached.

Superset version

4.0.1

Python version

3.11

Node version

I don't know

Browser

Chrome

Additional context

No response

Checklist

  • [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [X] 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.

Comment From: dosubot[bot]

To resolve the error message "The row limit set for the chart was reached. The chart may show partial data" when creating a chart from SQL Lab in Apache Superset, you need to increase the displayLimit or defaultQueryLimit in the ResultSetProps.

Here is an example of how you can adjust these limits:

const ResultSet = ({
  cache = false,
  csv = true,
  database = {},
  displayLimit = 1000, // Increase this value
  height,
  queryId,
  search = true,
  showSql = false,
  showSqlInline = false,
  visualize = true,
  defaultQueryLimit = 1000, // Increase this value
}: ResultSetProps) => {
  // ... rest of the code
};

By increasing the displayLimit and defaultQueryLimit values, you can allow more rows to be displayed in the chart, thus avoiding the error message [1].

To continue talking to Dosu, mention @dosu.

Comment From: Habeeb556

@dosu

How can I adjust this limit? Which file path should I use?

Comment From: dosubot[bot]

To adjust the row limit in Apache Superset, you need to modify the configuration settings in the superset_config.py file and ensure the ResultSetProps in the frontend code reflects these changes.

  1. Locate the superset_config.py file: This file is typically found in the root directory of your Superset installation or in the configuration directory.

  2. Add or update the following configuration settings in the superset_config.py file:

# Set the maximum number of rows to display in the chart
DISPLAY_MAX_ROW = 10000  # Adjust this value as needed

# Set the default query limit
DEFAULT_SQLLAB_LIMIT = 10000  # Adjust this value as needed
  1. Update the frontend code: Ensure that the ResultSetProps in the frontend code reflects these changes. The relevant file is superset-frontend/src/SqlLab/components/ResultSet/index.tsx.

Here is a snippet of the ResultSetProps interface:

export interface ResultSetProps {
  cache?: boolean;
  csv?: boolean;
  database?: Record<string, any>;
  displayLimit: number;
  height: number;
  queryId: string;
  search?: boolean;
  showSql?: boolean;
  showSqlInline?: boolean;
  visualize?: boolean;
  defaultQueryLimit: number;
}

Make sure that the displayLimit and defaultQueryLimit values are set appropriately in the component where ResultSetProps is used.

  1. Restart your Superset server: After making these changes, restart your Superset server to apply the new settings.

By following these steps, you should be able to adjust the row limit and resolve the error message in Apache Superset version 4.0.1 [1][2].

To continue talking to Dosu, mention @dosu.

Comment From: Habeeb556

@dosu

It doesn't affect the chart; it impacts SQLLab directly.

Comment From: dosubot[bot]

To adjust the row limit specifically for SQLLab in Apache Superset version 4.0.1, you need to modify the DISPLAY_MAX_ROW configuration setting. This setting is used to limit the number of rows returned by a SQL query in SQLLab.

  1. Locate the superset_config.py file: This file is typically found in the root directory of your Superset installation or in the configuration directory.

  2. Add or update the following configuration setting in the superset_config.py file:

# Set the maximum number of rows to display in SQLLab
DISPLAY_MAX_ROW = 10000  # Adjust this value as needed
  1. Restart your Superset server: After making these changes, restart your Superset server to apply the new settings.

By setting the DISPLAY_MAX_ROW configuration, you can control the number of rows returned in SQLLab, thus avoiding the error message indicating that the row limit has been reached [1][2].

To continue talking to Dosu, mention @dosu.

Comment From: Habeeb556

Not solved, still got chart error Limit reached.

Comment From: dosubot[bot]

To resolve the "Limit reached" error in Apache Superset version 4.0.1 when creating a chart from SQLLab, ensure that the following configurations are set correctly in your superset_config.py file:

  1. Set the maximum number of rows to display in SQLLab:
DISPLAY_MAX_ROW = 10000  # Adjust this value as needed
  1. Set the maximum number of rows returned for any analytical database query:
SQL_MAX_ROW = 100000  # Adjust this value as needed
  1. Set the default row limit for SQL Lab queries:
DEFAULT_SQLLAB_LIMIT = 1000  # Adjust this value as needed

After updating these configurations, restart your Superset server to apply the new settings. This should help manage the row limits effectively and resolve the "Limit reached" error [1][2][3].

To continue talking to Dosu, mention @dosu.

Comment From: Habeeb556

Any suggestions? This is also related to the discussion in option #29411.

Comment From: dosubot[bot]

To resolve the "Limit reached" error in Apache Superset version 4.0.1, ensure that the following configurations are set correctly in your superset_config.py file:

  1. Set the maximum number of rows to display in SQLLab:
DISPLAY_MAX_ROW = 10000  # Adjust this value as needed
  1. Set the maximum number of rows returned for any analytical database query:
SQL_MAX_ROW = 100000  # Adjust this value as needed
  1. Set the default row limit for SQL Lab queries:
DEFAULT_SQLLAB_LIMIT = 1000  # Adjust this value as needed

Additionally, verify that these configurations are being applied correctly in the backend and frontend code:

  • Backend: Ensure the apply_display_max_row_limit function in superset/views/utils.py and the execute_sql_statement function in superset/sql_lab.py are using these values correctly [1][2].

  • Frontend: Ensure the displayLimit and defaultQueryLimit props in the ResultSet component in superset-frontend/src/SqlLab/components/ResultSet/index.tsx are set appropriately [3].

After making these changes, restart your Superset server to apply the new settings. This should help manage the row limits effectively and resolve the "Limit reached" error.

Additionally, you might find these similar issues and discussions helpful:

  • Issue #22485: Suggests modifying the superset_config_docker.py file to increase the row limit for charts.
  • Issue #28644: Recommends using Apache Superset version 3.1.3 or 4.0.1, as the bug was fixed in these versions.
  • Issue #26779: Resolved by a pull request that fixed the hardcoded row limit in the UI.
  • Issue #22569: Suggests updating to the latest version of Superset, as the issue has been fixed in the latest release.

These steps and resources should help you address the row limit issue in SQLLab.

To continue talking to Dosu, mention @dosu.

Comment From: rusackas

The default limit in SQL Lab is 1000... did you change it if needed?

Pasted_Image_7_1_24__9_46 AM

Comment From: Habeeb556

Yes, I know that, but the limitation is within the chart creation itself. I have already open limit in SQL Lab to 100k, but when creating a chart from result, I encountered the following message indicating that the 1k limit has been reached:

The row limit set for the chart was reached. The chart may show partial data.

Apache Superset The row limit set for the chart was reached.

Comment From: rusackas

Can you give us a reproducible test case using one of the example datasets? That'll help me (or anyone) more able to validate that it's happening this way on our instance(s) and see if we can find a solution/workaround.

Comment From: Habeeb556

1- Run any query in SQLLAB fetch 10K rows. 2- Then click on CREATE CHART to explore the result. 3- You will get only 1K rows limit.

Additionally, I am using this method to download the result as an XLSX file from the chart. Therefore, I request a discussion #29411 to add a "Download to XLSX" feature, similar to the "Download to CSV" button.

Comment From: mistwan

you can alter there ,

superset/common/query_object.py:150

# self.row_limit = row_limit
from superset import app
self.row_limit = app.config["ROW_LIMIT"]

then try superset custome config > page length

微信图片_20241213155945

Comment From: Habeeb556

Wow! it worked @mistwan thaanks.

Apache Superset The row limit set for the chart was reached.

Comment From: Habeeb556

@rusackas I think this should be reviewed as it might help mitigate the issue in the future.

Comment From: rusackas

I've totally lost track of what exactly needs to be changed here (if anything, in current versions) - is there a PR to be had, or a docs change? This hit my inactive issues radar, but I'd love to have proper closure here if we can make things better.

Comment From: rusackas

@dosu can you review this thread and suggest what fixes we should make in the codebase, or at least what docs we might want to add to the Superset website?

Comment From: dosubot[bot]

Here's what would help improve both the codebase and documentation:

Codebase:
The main fix is to ensure that the chart creation flow from SQLLab always respects the configurable row limits (like ROW_LIMIT and DISPLAY_MAX_ROW) and avoids hardcoded values. The workaround that worked for the user—setting self.row_limit = app.config["ROW_LIMIT"] in superset/common/query_object.py—should be reviewed and potentially formalized so that all chart creation paths consistently use the configured limits, not a default or hardcoded value. This would make the experience predictable and easier to manage for admins and users alike.
See the relevant code and config details here and here.

Documentation:
There’s a clear gap in the docs about how row limits work for SQLLab vs. chart creation. The website should have a section that explains: - The difference between SQLLab row limits and chart row limits. - How to configure all relevant row limit settings (ROW_LIMIT, DISPLAY_MAX_ROW, SQL_MAX_ROW, DEFAULT_SQLLAB_LIMIT, QUERY_SEARCH_LIMIT) in superset_config.py. - That after changing these values, a frontend rebuild may be required for changes to take effect. - Troubleshooting tips for when chart creation still shows partial data due to row limits, with practical examples.

A community best practice is to set all these config variables to high values if you need to work with large datasets, and to rebuild the frontend after making changes (discussion).

This would make the behavior much clearer for users and reduce confusion when limits are hit unexpectedly.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X