How to access Google Cloud SQL by Python in Google Compute Engine

Clash Royale CLAN TAG#URR8PPP
How to access Google Cloud SQL by Python in Google Compute Engine
I am new to programming and Google service. I have read this document and set up Cloud SQL access by IP address.
However for access from Python, the documentation is only for App Engine and using Proxy instead. How can I access from Python in Google Compute Engine? Thanks
@Mangu I have read that document. So My python script on Compute Engine should use proxy to access SQL Cloud?
– dinex
Aug 12 at 15:28
If your Cloud SQL instance is Second Gen, yes. There is an example in that very same page for both configuring the Proxy and connecting from your Compute instance to your Cloud SQL instance via the proxy.
– Mangu
Aug 12 at 16:23
1 Answer
1
Credit @Mangu
Depending upon the application and the requirements, you can configure to connect to the Cloud SQL from python in compute engine using external IP of the Cloud SQL instances or use Cloud SQL Proxy with python (The Cloud SQL Proxy is available only for Second Generation instances.)
Here is another complete example tutorial of using Cloud SQL with Python Bookshelf application.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Did you check this and this?
– Mangu
Aug 12 at 10:28