You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2026/02/20 23:07:54 UTC

[D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

GitHub user eschutho created a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456&result_type=query


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array).

No breaking changes to the API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.
	•	Regardless of RBAC configuration, validate that the chart belongs to the specified dashboard.

⸻

Out of Scope (V1)
	•	Batch extraction for multiple charts
	•	SQL diff tooling
	•	Interactive filter state overrides
	•	Cross-dashboard comparisons

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho closed a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

Example:

GET /api/v1/chart/123/data/?result_type=query

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array) except that it should not query the db for the data or return data.

This query param should be able to be used in conjunction with the dashboard filters param. e.g., 
GET /api/v1/chart/123/data/?filters_dashboard_id=456&result_type=query

And this request would return the sql quer(y/ies) for the chart with the default dashboard filters applied.

No breaking changes to the existing API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho edited a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

Example:

GET /api/v1/chart/123/data/?result_type=query

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array) except that it should not query the db for the data or return data.

No breaking changes to the API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.
	•	Regardless of RBAC configuration, validate that the chart belongs to the specified dashboard.

⸻

Out of Scope (V1)
	•	Batch extraction for multiple charts
	•	SQL diff tooling
	•	Interactive filter state overrides
	•	Cross-dashboard comparisons

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho edited a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

Example:

GET /api/v1/chart/123/data/?result_type=query

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array) except that it should not query the db for the data or return data.

No breaking changes to the existing API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.
	•	Regardless of RBAC configuration, validate that the chart belongs to the specified dashboard.

⸻

Out of Scope (V1)
	•	Batch extraction for multiple charts
	•	SQL diff tooling
	•	Interactive filter state overrides
	•	Cross-dashboard comparisons

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho edited a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

Example:

GET /api/v1/chart/123/data/?result_type=query

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array) except that it should not query the db for the data or return data.

This query param should be able to be used in conjunction with the dashboard filters param. e.g., 
GET /api/v1/chart/123/data/?filters_dashboard_id=456&result_type=query

And this request would return the sql quer(y/ies) for the chart with the default dashboard filters applied.

No breaking changes to the existing API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho edited a discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

[Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

Summary

Enhance the existing GET /api/v1/chart/{id}/data endpoint to support an optional filters_dashboard_id parameter that returns the chart’s compiled SQL as rendered within a specific dashboard context, including applicable dashboard default filters.

This enables programmatic SQL extraction for validation workflows (e.g., warehouse migrations, regression testing, governance).

⸻

Problem

Today:
	•	GET /api/v1/chart/{id}/data returns a query but does not allow specifying dashboard context.
	•	POST /api/v1/chart/data requires reconstructing form_data and manually injecting filter values.

There is no supported way to:
	•	Pass a chart_id
	•	Pass a dashboard_id
	•	Automatically apply dashboard default filters
	•	Retrieve the compiled SQL exactly as rendered in a dashboard

This makes automated validation workflows brittle and error-prone.

⸻

Proposed Solution

Extend:

GET /api/v1/chart/{id}/data

To accept an optional parameter:

filters_dashboard_id=<dashboard_id>

Example:

GET /api/v1/chart/123/data/?filters_dashboard_id=456


⸻

Expected Behavior

When filters_dashboard_id is provided:
	1.	Validate that the chart belongs to the specified dashboard.
	2.	Identify dashboard filters scoped to the chart.
	3.	Apply their default values.
	4.	Construct an effective copy of the chart’s form_data (MUST NOT mutate stored config).
	5.	Build a QueryContext from the effective form_data.
	6.	Generate SQL using the existing datasource query-building pipeline.
	7.	Return the response using the existing /chart/{id}/data response structure.

If filters_dashboard_id is not provided, behavior remains unchanged.

⸻

SQL Parity Requirement

The endpoint MUST reuse the existing dashboard filter application and query generation pipeline used during dashboard rendering.

It MUST NOT reimplement or duplicate filter-merging logic.

The compiled SQL MUST match the SQL generated when rendering the same chart inside the dashboard with default filters applied.

⸻

Compile-Only Mode

The endpoint MUST support:

result_type=query

In this mode:
	•	SQL is compiled but not executed.
	•	The existing response structure is preserved.
	•	Each entry in result[] contains the compiled query.

Example:

GET /api/v1/chart/123/data/?result_type=query

⸻

Response Format

The response MUST remain identical to the existing /api/v1/chart/{id}/data response structure (including support for multiple queries in the result array).

No breaking changes to the API contract.

⸻

Access Control
	•	Enforce datasource-level permissions.
	•	If Dashboard RBAC is enabled, enforce dashboard access permissions.
	•	Regardless of RBAC configuration, validate that the chart belongs to the specified dashboard.

⸻

Out of Scope (V1)
	•	Batch extraction for multiple charts
	•	SQL diff tooling
	•	Interactive filter state overrides
	•	Cross-dashboard comparisons

⸻

Additional Context

This feature is intended to support:
	•	Warehouse migration validation
	•	SQL regression testing
	•	Governance and audit workflows
	•	API-first automation use cases


GitHub link: https://github.com/apache/superset/discussions/38133

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [D] [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data [superset]

Posted by "eschutho (via GitHub)" <gi...@apache.org>.
GitHub user eschutho added a comment to the discussion: [Feature] Support dashboard-context SQL compilation via filters_dashboard_id on /api/v1/chart/{id}/data

We have plans to work on this soon.

GitHub link: https://github.com/apache/superset/discussions/38133#discussioncomment-15877122

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org