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

   <!-- Greeting -->
   Hey @robshep, I'm here to help you with your Superset issue. I'm a bot that 
can assist with bug fixes, answer questions, and guide you on becoming a 
contributor. Let's work on resolving this together!
   
   <!-- Answer -->
   To resolve the error "Error: column 'string' does not exist LINE 6: AND 
(string)" when loading the "births" sample dashboard in an embedded view in 
Superset 4.0.2, ensure that the column names used in the SQL queries and 
filters are correctly defined and exist in the database schema.
   
   Based on the `birth_names` table schema, the available columns are: `ds`, 
`gender`, `name`, `num`, and `state`. Verify that the `subject` parameter 
passed to the `gen_filter` function corresponds to an actual column name in 
your database schema.
   
   For example, in the `create_slices` function, filters are generated like 
this:
   
   ```python
   adhoc_filters=[gen_filter("gender", "girl")]
   ```
   
   Ensure that the column `gender` exists in your database schema. Similarly, 
check all other instances where `gen_filter` is used or where columns are 
referenced in the code.
   
   Here is a snippet of the `gen_filter` function for reference:
   
   ```python
   def gen_filter(
       subject: str, comparator: str, operator: str = "=="
   ) -> dict[str, Union[bool, str]]:
       return {
           "clause": "WHERE",
           "comparator": comparator,
           "expressionType": "SIMPLE",
           "operator": operator,
           "subject": subject,
       }
   ```
   
   Ensure that the `subject` parameter matches the actual column names in your 
database. For the `birth_names` table, valid column names include `ds`, 
`gender`, `name`, `num`, and `state` 
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/examples/birth_names.py)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/plugin-chart-table/birthNames.json)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset-frontend/spec/fixtures/mockDatasource.js)</sup><sup>[[4]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-chart-controls/src/fixtures.ts)</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