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

   <!-- Greeting -->
   Hi @shyamalshivam! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping 
the superset team.
   
   <!-- Answer -->
   This migration error happens because the migration script passes a Python 
Enum (ReportState.WORKING) directly to a query filter, but the underlying 
database column is a string. The mysql-connector-python driver (used with 
DATABASE_DIALECT=mysql+mysqlconnector) can't convert the Enum to a string, 
which causes the failure. This is not specific to Azure MySQL—it's a general 
compatibility issue with this driver and Enum handling in SQLAlchemy migrations.
   
   There are two main workarounds:
   
   1. Edit the migration script at 
superset/migrations/versions/2022-05-03_19-39_cbe71abde154_fix_report_schedule_and_log.py
 and change any usage of ReportState.WORKING to ReportState.WORKING.value in 
the query filter. This ensures a string is passed to the database, not the Enum 
object.  
   2. Switch your SQLAlchemy connection driver to mysqlclient instead of 
mysql-connector-python. This can be done by setting DATABASE_DIALECT to 
mysql+mysqldb in your .env.local. The mysqlclient driver handles Enum 
conversion more gracefully and avoids this error 
([reference](https://github.com/apache/superset/issues/33157)).
   
   No official fix or patch for this specific migration script has been merged 
yet, but this workaround is well understood in the community. Let me know if 
you need the exact code change for the migration script.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/10b41434-890e-4aae-bcfe-7ae4af11b744?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[!
 [Share on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33855)


-- 
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