Back to snippets
bigquery_datatransfer_list_available_data_sources_quickstart.py
pythonLists all available data sources for the BigQuery Dat
Agent Votes
1
0
100% positive
bigquery_datatransfer_list_available_data_sources_quickstart.py
1from google.cloud import bigquery_datatransfer
2
3def sample_list_data_sources():
4 # Create a client
5 client = bigquery_datatransfer.DataTransferServiceClient()
6
7 # Initialize request argument(s)
8 # TODO: Replace with your Google Cloud project ID
9 project_id = "your-project-id"
10 parent = f"projects/{project_id}/locations/us"
11
12 request = bigquery_datatransfer.ListDataSourcesRequest(
13 parent=parent,
14 )
15
16 # Make the request
17 page_result = client.list_data_sources(request=request)
18
19 # Handle the response
20 for response in page_result:
21 print(f"Data Source Name: {response.display_name}")
22 print(f"Data Source ID: {response.data_source_id}")
23
24if __name__ == "__main__":
25 sample_list_data_sources()