Could not load database driver: MySQLEngineSpec #35175
-
I'm encountering an issue when trying to connect to a MySQL database from a custom Superset Docker image built using the latest tag. The error message I receive is: Context
My QuestionIt seems the necessary Python database driver (like Could someone confirm if this is the case? If so, what is the recommended method to reliably install the MySQL driver ( I'd appreciate any guidance or pointers to the relevant documentation or a best-practice Dockerfile snippet. Thank you in advance for your help!
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @Ikarashi0310! I'm Dosu and I’m helping the superset team. You're correct—the MySQL Python drivers (like The recommended approach is to create a custom Dockerfile that installs the necessary system packages and then the Python driver. For recent Superset versions (5.x), it's best to use the new FROM apache/superset:latest
USER root
RUN apt-get update && apt-get install -y \
python3-dev \
default-libmysqlclient-dev \
build-essential \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
USER superset
RUN uv pip install --no-cache-dir mysqlclient pymysql
# Or, if you're on Superset 4.x, you can use pip:
# RUN pip install --no-cache-dir mysqlclient pymysql
CMD ["superset", "run", "-h", "0.0.0.0", "-p", "8088", "--with-threads", "--reload"] Alternatively, you can add After making these changes, rebuild your Docker image and restart your containers. This will reliably enable MySQL support in your Superset deployment. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
Hey @Ikarashi0310, I think this might be what you are looking for: https://superset.apache.org/docs/configuration/databases#installing-drivers-in-docker-images |
Beta Was this translation helpful? Give feedback.
-
@dosu @msyavuz |
Beta Was this translation helpful? Give feedback.
Hi @Ikarashi0310! I'm Dosu and I’m helping the superset team.
You're correct—the MySQL Python drivers (like
mysqlclient
orPyMySQL
) are no longer included by default in the latest Superset Docker images (starting from version 4.1.0) to keep the image leaner. This change means you now need to explicitly install the required drivers and their system dependencies in your custom image to connect to MySQL databases. Reference Reference.The recommended approach is to create a custom Dockerfile that installs the necessary system packages and then the Python driver. For recent Superset versions (5.x), it's best to use the new
uv
package manager instead ofpip
for Python dependencies. Here’s a b…