1

I am trying to run alembic on GCP cloud shell and do some basic schema migrations on cloud SQL.

for the setup, I created a MySQL instance on cloud SQL and created a database and user. I installed alembic on the cloud shell and did "alembic init migrations" in the alembic.ini file I set the URL to:

''' sqlalchemy.url = mysql://db_user:db_password@db_public_ip/db_name?unix_socket =/cloudsql/db_project_ID:db_instance_name '''

I get the following error when I run

''' alembic revision --autogenerate -m "user model" '''

ERROR: File "/home/akhil_abk709/.local/lib/python3.9/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 163, in dbapi return import("MySQLdb") ModuleNotFoundError: No module named 'MySQLdb'

I suspect the reason is my URL is incorrect. please help thank you!

Akhil Kv
  • 139
  • 1
  • 11
  • Can you check if your Python version is up-to-date by running `python3 --version`? Can you also check if pip is installed as well by running `python3 -m pip --version`? You can check this link on [installing packages](https://packaging.python.org/en/latest/tutorials/installing-packages/). – Robert G May 20 '22 at 07:39
  • was able to figure it out. It was my URL. But I am getting new issues – Akhil Kv May 20 '22 at 08:05
  • Kindly post it as an answer so that the community with similar question as yours will find it helpful. Also, please post another question if this is a different issue. – Robert G May 20 '22 at 08:32

0 Answers0