SAP Datasphere를 쿼리하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 BigQuery 연결 사용자(roles/bigquery.connectionUser) IAM 역할을 부여해 달라고 요청하세요.
역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.
GoogleSQL 쿼리에서 통합 쿼리를 SAP Datasphere로 보내려면 EXTERNAL_QUERY 함수를 사용합니다.
다음 예는 SAP Datasphere의 ORDERS 테이블과 BigQuery의 mydataset.customers 테이블을 조인하는 통합 쿼리입니다.
SELECTc.customer_id,c.name,rq.first_order_dateFROMmydataset.customersAScLEFTOUTERJOINEXTERNAL_QUERY('connection_id','''SELECT CUSTOMER_ID, MIN(ORDER_DATE) AS first_order_date FROM ORDERS GROUP BY CUSTOMER_ID''')ASrqONrq.customer_id=c.customer_idGROUPBYc.customer_id,c.name,rq.first_order_date;
SAP Datasphere 테이블 스키마 보기
다음 예에서는 EXTERNAL_QUERY 함수를 사용하여 SAP Datasphere의 SYS 스키마에서 데이터베이스 메타데이터를 가져옵니다.
-- List all views in a schema.SELECT*FROMEXTERNAL_QUERY('connection_id','''SELECT VIEW_NAME FROM SYS.VIEWS WHERE SCHEMA_NAME = 'MY_SCHEMA'''');
-- List all columns in a view.SELECT*FROMEXTERNAL_QUERY('connection_id','''SELECT COLUMN_NAME, DATA_TYPE_NAME FROM SYS.VIEW_COLUMNS WHERE SCHEMA_NAME = 'MY_SCHEMA' AND VIEW_NAME = 'my_view' ORDER BY POSITION''');
가격 책정
통합 쿼리 실행 비용은 다음 세 가지 요소를 기반으로 합니다.
SAP Datasphere에서 쿼리를 실행하는 컴퓨팅 비용
SAP Datasphere에서 BigQuery로 쿼리 결과를 전송하는 대역폭 비용
BigQuery에서 쿼리를 실행하는 데 드는 컴퓨팅 비용
SAP Datasphere 관련 비용은 사용하는 SAP 서비스 유형에 따라 다릅니다. 대역폭 비용을 제한하려면 최종 결과를 계산하는 데 필요하지 않은 모든 열과 행을 제외하도록 EXTERNAL_QUERY에 쿼리를 작성하는 것이 좋습니다.
BigQuery에서 통합 쿼리를 실행하는 데는 추가 비용이 발생하지 않습니다.
BigQuery 가격에 대한 자세한 내용은 가격 책정을 참조하세요.
[[["이해하기 쉬움","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-03(UTC)"],[[["\u003cp\u003eBigQuery's SAP Datasphere federation allows real-time querying of data in SAP Datasphere without data replication.\u003c/p\u003e\n"],["\u003cp\u003eFederated queries to SAP Datasphere are executed using the \u003ccode\u003eEXTERNAL_QUERY\u003c/code\u003e function within BigQuery, with results transferred back to BigQuery.\u003c/p\u003e\n"],["\u003cp\u003eThis feature is currently in a Pre-GA phase and has limitations, including querying only relational views exposed for consumption, potential higher latency, and no SQL pushdown support.\u003c/p\u003e\n"],["\u003cp\u003eUsers require the BigQuery Connection User IAM role to query SAP Datasphere and must have an existing shared connection.\u003c/p\u003e\n"],["\u003cp\u003eThe cost of federated queries is based on compute in both SAP Datasphere and BigQuery, and bandwidth for transferring results.\u003c/p\u003e\n"]]],[],null,["# SAP Datasphere federated queries\n================================\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| **Note:** To get support or provide feedback for this preview feature, contact [bq-sap-federation-support@google.com](mailto:bq-sap-federation-support@google.com).\n\nAs a data analyst, you can query relational data in SAP Datasphere from BigQuery using federated queries.\n\nBigQuery SAP Datasphere federation lets BigQuery query data residing in SAP Datasphere in real time, without copying or moving data.\n\nTo run a SQL query in SAP Datasphere, specify that SQL query within BigQuery in a `EXTERNAL_QUERY` function. The results are then transferred from SAP Datasphere to BigQuery.\n\nLimitations\n-----------\n\n- You can only query relational views that are [exposed for consumption](https://help.sap.com/docs/SAP_DATASPHERE/43509d67b8b84e66a30851e832f66911/d7d56284bb5148c887ac4054689bfbca.html?locale=en-US). Other objects in SAP Datasphere are not accessible to the query federated through `EXTERNAL_QUERY`.\n- The federated query latency might be noticeably higher than the same query if it was executed directly in SAP Datasphere.\n- The first query that uses SAP Datasphere connection in a given project might take more than a minute to run.\n- No additional [SQL pushdowns](/bigquery/docs/federated-queries-intro#sql_pushdowns) are supported for SAP Datasphere.\n- The SAP Datasphere SQL query must specify aliases for columns that contain function results.\n- When the usage of Compute Engine API in the query project is restricted by [VPC Service Controls](/vpc-service-controls/docs/overview), the federated query will fail.\n\nBefore you begin\n----------------\n\nEnsure that your BigQuery administrator has [created a SAP Datasphere connection](/bigquery/docs/connect-to-sap-datasphere)\nand [shared](/bigquery/docs/connect-to-sap-datasphere#share_connections)\nit with you.\n\n### Required roles\n\n\nTo get the permissions that\nyou need to query SAP Datasphere,\n\nask your administrator to grant you the\n\n\n[BigQuery Connection User](/iam/docs/roles-permissions/bigquery#bigquery.connectionUser) (`roles/bigquery.connectionUser`)\nIAM role on the project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nQuery data\n----------\n\nTo send a federated query to SAP Datasphere from a GoogleSQL query, use the\n[EXTERNAL_QUERY function](/bigquery/docs/reference/standard-sql/federated_query_functions#external_query).\n\nThe following example is a federated query that joins a table in SAP Datasphere named `ORDERS` and a table in BigQuery named `mydataset.customers`. \n\n SELECT c.customer_id, c.name, rq.first_order_date\n FROM mydataset.customers AS c\n LEFT OUTER JOIN EXTERNAL_QUERY(\n 'connection_id',\n '''SELECT CUSTOMER_ID, MIN(ORDER_DATE) AS first_order_date\n FROM ORDERS\n GROUP BY CUSTOMER_ID''') AS rq\n ON rq.customer_id = c.customer_id\n GROUP BY c.customer_id, c.name, rq.first_order_date;\n\nView a SAP Datasphere table schema\n----------------------------------\n\nThe following examples use the [EXTERNAL_QUERY function](/bigquery/docs/reference/standard-sql/federated_query_functions#external_query) to retrieve database metadata from the\n`SYS` schema in SAP Datasphere. \n\n -- List all views in a schema.\n SELECT * FROM EXTERNAL_QUERY(\n 'connection_id',\n '''SELECT VIEW_NAME FROM SYS.VIEWS\n WHERE SCHEMA_NAME = 'MY_SCHEMA'''');\n\n -- List all columns in a view.\n SELECT * FROM EXTERNAL_QUERY(\n 'connection_id',\n '''SELECT COLUMN_NAME, DATA_TYPE_NAME\n FROM SYS.VIEW_COLUMNS\n WHERE SCHEMA_NAME = 'MY_SCHEMA' AND\n VIEW_NAME = 'my_view'\n ORDER BY POSITION''');\n\nPricing\n-------\n\nThe cost of running a federated query is based on three factors:\n\n- The compute cost of executing the query in SAP Datasphere.\n- The bandwidth cost of transferring the query results from SAP Datasphere to BigQuery.\n- The compute cost of executing the query in BigQuery.\n\nAny SAP Datasphere related costs depend on the type of SAP service you use. To\nlimit the bandwidth cost, we recommend that you write the query in the\n`EXTERNAL_QUERY` so that it excludes all columns and rows that are not needed to\ncompute the final result.\n\nThere is no additional cost for running federated queries in BigQuery.\nFor more information about BigQuery pricing, see [Pricing](/bigquery/pricing).\n\nWhat's next\n-----------\n\n- Learn about [federated queries](/bigquery/docs/federated-queries-intro).\n- Learn about [unsupported data types](/bigquery/docs/reference/standard-sql/federated_query_functions#unsupported_data_types)."]]