¿How to connect SQL CLoud from App Engine with pymysql on python?

91 views
Skip to first unread message

Compra Segura

unread,
Feb 12, 2020, 12:17:25 PM2/12/20
to Google Cloud SQL discuss
I was trying to connect my app in App Engine to a databse that I have in SQL Cloud, but i don't undertand how to do conenct and do the querys in my code in App Engine. Please if someone could help me, I am 2 days trying.

Jad El Houssami

unread,
Feb 13, 2020, 10:16:34 AM2/13/20
to Google Cloud SQL discuss
Hello, 

I was able to find documentation that includes the instructions needed to connect to a Cloud SQL (MySQL) instance to App Engine.

Since you already have your Cloud SQL instance set up, you will also need to enable the Cloud SQL Admin API if you haven’t already done so.

Both App Engine Standard and Flex use a service account to authorize connections to Cloud SQL, however you will need to give it the appropriate IAM permissions to connect. Additionally, App Engine Flex also supports connecting the Cloud SQL using TCP or a Unix domain.

Lastly, you can refer to this section for sample python code as well as steps on how to connect using TCP or a Unix domain. You may also refer to this GitHub page for a code snippet in the context of a web application.

For future posts, please keep in mind that Google Groups are generally reserved for discussions and opinions about Google products, you may want to refer to Stack Exchange for how-to and technical questions since the answer-question format on those sites will give your question greater visibility. Nonetheless, I hope this information helps point you in the right direction for the moment.
Reply all
Reply to author
Forward
0 new messages