Home > OS >  How do I add an SQL connection in VSCode's "Run/Debug on Cloud Run Emulator" Build Se
How do I add an SQL connection in VSCode's "Run/Debug on Cloud Run Emulator" Build Se

Time:03-08

I am writing my first python 3.10 application in Visual Studio Code and aim to deploy that application to Cloud Run soon. I have a Cloud SQL database that stores my data for the application.

Before deploying I want to debug my application with the Cloud Code plugin for VSCode. The Cloud Code plugin has a convenient "Debug on Cloud Emulator" command that I can use for that purpose, but I am struggling to figure out how to add SQL connections in my Build Settings before running the Cloud Emulator.

Can somebody help me figure out the syntax for adding a Cloud SQL connection under the Advanced Service Settings?

enter image description here

Any examples / resources would be incredibly useful.

Thanks so much for your help up front!

CodePudding user response:

In the Cloud SQL - Overview screen, you can find the connection name of your instance in this format:

PROJECT-ID:REGION:INSTANCE-ID

Additionally, see this article on the connection options for Cloud SQL. You may also need to setup a Cloud SQL Auth proxy to provide secure access to your Cloud SQL instance.

  • Related