dosubot[bot] commented on issue #30068:
URL: https://github.com/apache/superset/issues/30068#issuecomment-2321308561

   <!-- Greeting -->
   @Cmagno13 Hello there! I'm here to help you with any issues you may be 
experiencing. I can assist in solving bugs, answering questions, and even guide 
you on becoming a contributor. Let's work together to resolve your concerns.
   
   <!-- Answer -->
   I found a similar issue related to the Event Flow chart in Superset version 
4.0.2. The error "Datetime column not provided as part table configuration and 
is required by this type of chart" typically occurs when the datetime column is 
not correctly included in the table configuration.
   
   To resolve this, ensure that your dataset includes a column mapped to the 
`__timestamp` field. The `TS` (timestamp) is derived from the `__timestamp` 
field in the data records. Here is the relevant part of the code that handles 
the datetime column:
   
   ```ts
   [TS]: (datum: TimeseriesDataRecord): Date | null =>
     datum.__timestamp || datum.__timestamp === 0
       ? new Date(datum.__timestamp)
       : null,
   ```
   
   Make sure your dataset includes a `__timestamp` field with valid datetime 
values. If your dataset does not have a `__timestamp` field, you need to add it 
or map your existing datetime column to `__timestamp` 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-plugin-chart-event-flow/src/transformProps.ts)</sup>.
   
   Additionally, ensure that your visualization class, such as `EventFlowViz`, 
correctly handles the datetime column. The `EventFlowViz` class inherits from 
`BaseViz` and sets `is_timeseries` to `True`, indicating that a datetime column 
is required:
   
   ```py
   class EventFlowViz(BaseViz):
       """A visualization to explore patterns in event sequences"""
   
       viz_type = "event_flow"
       verbose_name = _("Event flow")
       credits = 'from <a 
href="https://github.com/williaster/data-ui";>@data-ui</a>'
       is_timeseries = True
   
       @deprecated(deprecated_in="3.0")
       def query_obj(self) -> QueryObjectDict:
           query = super().query_obj()
           form_data = self.form_data
   
           event_key = form_data["all_columns_x"]
           entity_key = form_data["entity"]
           meta_keys = [
               col
               for col in form_data["all_columns"] or []
               if col not in (event_key, entity_key)
           ]
   
           query["columns"] = [event_key, entity_key] + meta_keys
   
           if form_data["order_by_entity"]:
               query["orderby"] = [(entity_key, True)]
   
           return query
   
       @deprecated(deprecated_in="3.0")
       def get_data(self, df: pd.DataFrame) -> VizData:
           return df.to_dict(orient="records")
   ```
   
   Ensure that your form data includes the necessary datetime configuration and 
that the `query_obj` method correctly includes the datetime column in the query 
<sup>[[2]](https://github.com/apache/superset/blob/master/superset/viz.py)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to