[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eBigQuery enables querying data from external sources like Cloud Storage, Spanner, AWS, and Azure through the BigQuery Connection API.\u003c/p\u003e\n"],["\u003cp\u003eConnections are securely encrypted and stored, eliminating the need to send database credentials as cleartext, and they can be shared with users via IAM roles.\u003c/p\u003e\n"],["\u003cp\u003eBigQuery supports various connection types for different external data sources, including Amazon S3, Azure Blob Storage, Google Cloud resources, Spanner, Cloud SQL, AlloyDB, SAP Datasphere, and Spark.\u003c/p\u003e\n"],["\u003cp\u003eOnce a connection is established, users can create external tables, run queries, export results, and build datasets based on data from these external sources.\u003c/p\u003e\n"],["\u003cp\u003eConnections are used to run federated queries, create external tables, remote functions, remote models, and other objects related to data outside BigQuery.\u003c/p\u003e\n"]]],[],null,["# Introduction to connections\n===========================\n\nBigQuery lets you create external connections to query data that's\nstored outside of BigQuery in Google Cloud services like\nCloud Storage or Spanner, or in third-party sources like\nAmazon Web Services (AWS) or Microsoft Azure. These external connections use the\nBigQuery Connection API.\n\nFor example, suppose that you store details about customer orders in Cloud SQL\nand data about sales in BigQuery, and you want to join the two\ntables in a single query. You can create a Cloud SQL connection to the\nexternal database by using the BigQuery Connection API. With connections, you never\nsend database credentials as\n[cleartext](https://simple.wikipedia.org/wiki/Cleartext).\n\nA connection is encrypted and securely stored in the BigQuery\nconnection service. You can [give users access to connections](/bigquery/docs/working-with-connections#share-connections)\nby granting them BigQuery connection Identity and Access Management (IAM)\nroles.\n\nConnection types\n----------------\n\nBigQuery provides different connection types for the following external data sources:\n\n- Amazon Simple Storage Service (Amazon S3)\n- Apache Spark\n- Azure Blob Storage\n- Google Cloud resources such as Vertex AI remote models, remote functions, and BigLake\n- Spanner\n- Cloud SQL\n- AlloyDB for PostgreSQL\n- SAP Datasphere\n\n| **Note:** You don't need a connection to query data in [Bigtable](/bigquery/docs/external-data-bigtable) and [Google Drive](/bigquery/docs/external-data-drive).\n\n### Amazon S3 connections\n\nTo create an Amazon S3 connection with BigQuery Omni, see\n[Connect to Amazon S3](/bigquery/docs/omni-aws-create-connection).\n\nOnce you have an existing Amazon S3 connection, you can do the following:\n\n- [Create external tables on Amazon S3](/bigquery/docs/omni-aws-create-external-table)\n- [Query the Amazon S3 data](/bigquery/docs/query-aws-data)\n- [Export results to Amazon S3](/bigquery/docs/omni-aws-export-results-to-s3)\n- [Create datasets based on AWS Glue databases](/bigquery/docs/glue-federated-datasets).\n\n### Spark connections\n\n[Stored procedures for Spark](/bigquery/docs/spark-procedures) let\nyou run stored procedures written in Python using BigQuery. A\n[Spark connection](/bigquery/docs/connect-to-spark) lets you connect to\nDataproc Serverless and run the stored procedures for Spark.\n\nTo create this connection, see [Create connections](/bigquery/docs/connect-to-spark#create-spark-connection).\n\n### Blob Storage connections\n\nTo create a Blob Storage connection with BigQuery Omni, see\n[Connect to Blob Storage](/bigquery/docs/omni-azure-create-connection).\n\nOnce you have an existing Blob Storage connection, you can do the following:\n\n- [Create external tables based on Blob Storage](/bigquery/docs/omni-azure-create-external-table)\n- [Query the Blob Storage data](/bigquery/docs/query-azure-data)\n- [Export results to Blob Storage](/bigquery/docs/omni-azure-export-results-to-azure-storage)\n\n### Google Cloud resource connections\n\nA Google Cloud resource connection is a connection to authorize access to other Google Cloud\nresources such as Vertex AI remote models, remote functions, and\nBigLake. For details on how to set up a Google Cloud resource connection, see\n[Create and set up a Cloud resource connection](/bigquery/docs/create-cloud-resource-connection).\n\nOnce you have an existing Google Cloud resource connection, you can create the following\nBigQuery objects with it:\n\n- **Remote models** . For more information, see [The CREATE MODEL statement for remote models over LLMs](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model), [The CREATE MODEL statement for remote models over Cloud AI services](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-service), and [The CREATE MODEL statement for remote models over Vertex AI hosted models](/bigquery/docs/reference/standard-sql/bigqueryml-syntax-create-remote-model-https).\n- **Remote functions** . BigQuery [remote functions](/bigquery/docs/remote-functions) let you implement functions with any supported languages in Cloud Run functions or Cloud Run. A remote function connection lets you connect with Cloud Run functions or Cloud Run and run these functions. To create a BigQuery remote function connection, see [Create a connection](/bigquery/docs/remote-functions#create_a_connection).\n- **BigLake tables** . BigLake connections connect [BigLake tables](/bigquery/docs/biglake-intro) to external data sources while retaining fine-grained BigQuery access control and security for both structured and unstructured data in Cloud Storage.\n- **Object tables** . For more information, see [Introduction to object tables](/bigquery/docs/object-table-introduction).\n\n### Spanner connections\n\nTo create a Spanner connection, see [Connect to Spanner](/bigquery/docs/connect-to-spanner).\n\nOnce you have an existing Spanner connection, you can run\n[federated queries](/bigquery/docs/federated-queries-intro).\n\n### Cloud SQL connections\n\nTo create a Cloud SQL connection, see [Connect to Cloud SQL](/bigquery/docs/connect-to-sql).\n\nOnce you have an existing Cloud SQL connection, you can run\n[federated queries](/bigquery/docs/federated-queries-intro).\n\n### AlloyDB connections\n\nTo create an AlloyDB connection, see [Connect to AlloyDB for PostgreSQL](/bigquery/docs/connect-to-alloydb).\n\nOnce you have an existing AlloyDB connection, you can run\n[federated queries](/bigquery/docs/federated-queries-intro).\n\n### SAP Datasphere connections\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nTo create an SAP Datasphere connection, see [Connect to SAP Datasphere](/bigquery/docs/connect-to-sap-datasphere).\n\nOnce you have an existing SAP Datasphere connection, you can run\n[federated queries](/bigquery/docs/federated-queries-intro).\n\nAudit logs\n----------\n\nBigQuery logs usage and management requests about connections.\nFor more information, see [BigQuery audit logs overview](/bigquery/docs/reference/auditlogs).\n\nWhat's next\n-----------\n\n- Learn how to [manage connections](/bigquery/docs/working-with-connections).\n- Learn more about [default connections](/bigquery/docs/default-connections) for your project.\n- Learn how to [analyze object tables by using remote functions](/bigquery/docs/object-table-remote-function).\n- Learn how to query stored data:\n - [Query data stored in Amazon S3](/bigquery/docs/omni-aws-create-external-table).\n - [Query data stored in Blob Storage](/bigquery/docs/omni-azure-create-external-table).\n - [Query structured data stored in Cloud Storage](/bigquery/docs/query-cloud-storage-using-biglake#query-biglake-table-bigquery).\n - [Query unstructured data stored in Cloud Storage](/bigquery/docs/object-tables).\n - [Query data stored in Spanner](/bigquery/docs/spanner-federated-queries).\n - [Query data stored in Cloud SQL](/bigquery/docs/cloud-sql-federated-queries).\n - [Query data stored in AlloyDB](/bigquery/docs/alloydb-federated-queries).\n - [Query data using remote functions](/bigquery/docs/remote-functions#create_a_remote_function).\n - [Query unstructured data using remote functions](/bigquery/docs/object-table-remote-function).\n - [Query data using stored procedures for Apache Spark](/bigquery/docs/spark-procedures).\n- Learn about [external tables](/bigquery/docs/external-tables)."]]