Run Alembic migrations on Google App Engine

后端 未结 3 1896
执笔经年
执笔经年 2021-01-05 10:43

I have a Flask app that uses SQLAlchemy (Flask-SQLAlchemy) and Alembic (Flask-Migrate). The app runs on Google App Engine. I want to use Google Cloud SQL.

On my mac

3条回答
  •  长发绾君心
    2021-01-05 11:17

    • Whitelist your local machine's IP: https://console.cloud.google.com/sql/instances/INSTANCENAME/access-control/authorization?project=PROJECTNAME
    • Create an user: https://console.cloud.google.com/sql/instances/INSTANCENAME/access-control/users?project=PROJECTNAME
    • Assign an external IP address to the instance: https://console.cloud.google.com/sql/instances/INSTANCENAME/access-control/ip?project=PROJECTNAME
    • Use the following SQLAlchemy connection URI: SQLALCHEMY_DATABASE_URI = 'mysql://user:pw@ip:3306/DBNAME'
    • Remember to release the IP later as you are charged for every hour it's not used

提交回复
热议问题