Open dineshvk2 opened 1 month ago
Hey @dineshvk2! I'm here to help you with any bugs, questions, or contributions you have regarding the API issue. Let's work together to find a solution.
A similar issue has been reported and addressed. The error occurs when the granularity
variable is not provided and the is_timeseries
variable is True
. This triggers the 'Datetime column not provided' error in the API [1].
A fix has been implemented to address this issue. The specific change involves ensuring that the temporal column is added first to the columns array if it meets certain conditions. Here is the relevant code snippet:
const temporalColumnsLookup = formData?.temporal_columns_lookup;
// Filter out the column if needed and prepare the temporal column object
columns = columns.filter(col => {
const shouldBeAdded =
isPhysicalColumn(col) &&
time_grain_sqla &&
temporalColumnsLookup?.[col];
if (shouldBeAdded && !temporalColumnAdded) {
temporalColumn = {
timeGrain: time_grain_sqla,
columnType: 'BASE_AXIS',
sqlExpression: col,
label: col,
expressionType: 'SQL',
} as AdhocColumn;
temporalColumnAdded = true;
return false; // Do not include this in the output; it's added separately
}
return true;
});
// So we ensure the temporal column is added first
if (temporalColumn) {
columns = [temporalColumn, ...columns];
}
This code ensures that the temporal column is correctly added, thus resolving the issue with the missing Datetime column [2].
Additionally, saving the chart without making any changes updates the metadata
state, ensuring that the metadata
used for rendering in the UI and the metadata
sent in the API call are synchronized. This resolves any discrepancies and prevents the error from occurring [3].
For best practices, always specify the granularity
parameter for timeseries charts and ensure that the Datetime column is correctly configured in the table schema [1][4].
To continue talking to Dosu, mention @dosu.
Bug description
I’m encountering an issue with the API (/api/v1/chart/data) when fetching chart data. The error message states: 'Datetime column not provided as part of the table configuration and is required for this chart type.' Although the chart renders correctly in the UI, the API call fails. As a workaround, opening and saving the chart without making any changes resolves the issue. Has a fix been implemented for this? Same issue was reported earlier - https://apache-superset.slack.com/archives/C015WAZL0KH/p1667844640596479 Chart details - Temporal X-Axis - day column (timestamp) Time Grain - Week
How to reproduce the bug
Query context payload difference between initial version rendered and changes occurred after saving the chart without changes.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.10
Node version
16
Browser
Chrome
Additional context
No response
Checklist