简体   繁体   English

如何在 VSCode 的“在 Cloud Run 模拟器上运行/调试”构建设置中添加 SQL 连接

[英]How do I add an SQL connection in VSCode's "Run/Debug on Cloud Run Emulator" Build Settings

I am writing my first python 3.10 application in Visual Studio Code and aim to deploy that application to Cloud Run soon.我正在 Visual Studio Code 中编写我的第一个 python 3.10 应用程序,目标是尽快将该应用程序部署到 Cloud Run。 I have a Cloud SQL database that stores my data for the application.我有一个 Cloud SQL 数据库,用于存储我的应用程序数据。

Before deploying I want to debug my application with the Cloud Code plugin for VSCode.在部署之前,我想使用适用于 VSCode 的 Cloud Code 插件调试我的应用程序。 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. Cloud Code 插件有一个方便的“在 Cloud Emulator 上调试”命令,我可以将其用于该目的,但我正在努力弄清楚如何在运行 Cloud Emulator 之前在我的构建设置中添加 SQL 连接。

Can somebody help me figure out the syntax for adding a Cloud SQL connection under the Advanced Service Settings?有人可以帮我弄清楚在高级服务设置下添加 Cloud SQL 连接的语法吗?

在此处输入图像描述

Any examples / resources would be incredibly useful.任何示例/资源都将非常有用。

Thanks so much for your help up front!非常感谢您的帮助!

In the Cloud SQL - Overview screen, you can find the connection name of your instance in this format:在 Cloud SQL - Overview 屏幕中,您可以找到您的实例的连接名称,格式如下:

PROJECT-ID:REGION:INSTANCE-ID

Additionally, see this article on the connection options for Cloud SQL .此外,请参阅有关 Cloud SQL 连接选项的文章 You may also need to setup a Cloud SQL Auth proxy to provide secure access to your Cloud SQL instance.您可能还需要设置Cloud SQL Auth 代理以提供对 Cloud SQL 实例的安全访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有办法在 Cloud Build 中运行数据存储模拟器? - Is there a way to run the Datastore Emulator in Cloud Build? terraform 谷歌云运行添加云 sql 连接 - terraform google cloud run add cloud sql connection 谷歌云构建、云运行、云 SQL Prisma 迁移 - Google Cloud Build, Cloud Run, Cloud SQL Prisma Migration 使用CloudRun和Google SQL,cloud run会自动使用连接池吗? - Using CloudRun and Google SQL, will cloud run automatically use connection pooling? 为什么在使用 docker 部署云运行服务时出现 [INFO] Worker Exiting (pid: 2)? (在带有云代码扩展的 VSCode 上) - Why do I get [INFO] Worker Exiting (pid: 2) when deploying cloud run service with docker? (On VSCode with cloud code extension) 在云构建中运行 gcloud 脚本 - run gcloud script in cloud build 部署到云运行时出现云构建错误 - Cloud build error when deploying to cloud run GCP Cloud Run Cloud - 云 SQL 实例“${process.env.INSTANCE_CONNECTION_NAME}”不可访问 - GCP Cloud Run Cloud - Cloud SQL instance "${process.env.INSTANCE_CONNECTION_NAME}" is not reachable 如何在 Cloud Run for Anthos on Google Cloud 集群上启用 HTTPS? - How do I enable HTTPS on a Cloud Run for Anthos on Google Cloud cluster? 如何从 Cloud Run 安全地连接到 Cloud SQL? - How to securely connect to Cloud SQL from Cloud Run?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM