Stay organized with collections
Save and categorize content based on your preferences.
You can write functions that integrate with Cloud databases by importing the
appropriate Cloud Client Libraries for your chosen database into your source code.
To deploy and trigger the function, you can use either:
Cloud Run functions (Recommended)
The Cloud Functions gcloud CLI
This page provides more information for learning about connecting with a Cloud
database using Cloud Run.
Connect to Cloud SQL
Learn how to add database functionality to your Cloud Run with
Cloud SQL:
For connecting to a MySQL instance from a service running in
Cloud Run, see Connect from Cloud Run.
For connecting to a PostgreSQL instance from a service running in
Cloud Run, see Connect from Cloud Run.
For connecting to a SQL Server instance from a service running in
Cloud Run, see Connect from Cloud Run.
Connect to Cloud BigQuery
Learn how to write an HTTP Cloud Run function that submits a query to
BigQuery.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Integrate with Cloud databases\n\nYou can write functions that integrate with Cloud databases by importing the\nappropriate Cloud Client Libraries for your chosen database into your source code.\nTo deploy and trigger the function, you can use either:\n\n- Cloud Run functions (Recommended)\n- The Cloud Functions gcloud CLI\n\nThis page provides more information for learning about connecting with a Cloud\ndatabase using Cloud Run.\n\nConnect to Cloud SQL\n--------------------\n\nLearn how to add database functionality to your Cloud Run with\nCloud SQL:\n\n- For connecting to a MySQL instance from a service running in Cloud Run, see [Connect from Cloud Run](/sql/docs/mysql/connect-run).\n- For connecting to a PostgreSQL instance from a service running in Cloud Run, see [Connect from Cloud Run](/sql/docs/postgres/connect-run).\n- For connecting to a SQL Server instance from a service running in Cloud Run, see [Connect from Cloud Run](/sql/docs/sqlserver/connect-run).\n\nConnect to Cloud BigQuery\n-------------------------\n\nLearn how to write an HTTP Cloud Run function that submits a query to\nBigQuery.\n\nFor details, see\n[Create a Cloud Run function that returns BigQuery results](/run/docs/tutorials/function-returns-bigquery-query).\n\nConnect to Memorystore for Redis\n--------------------------------\n\nLearn about how to connect your Cloud Run functions to\na Memorystore for Redis in-memory database.\n\nFor details, see\n[Connecting to a Redis instance from Cloud Run functions](/memorystore/docs/redis/connect-redis-instance-functions) in the\nMemorystore documentation.\n\nUser Spanner with Cloud Run functions\n-------------------------------------\n\nLearn about how to write, deploy, and trigger an HTTP Cloud Function that\naccesses Spanner.\n\nFor details, see\n[Create a Cloud Run function that returns Spanner results](/run/docs/tutorials/function-sends-query-to-spanner-database)."]]