Use the BigQueryOperator

Use the BigQueryOperator in an Apache Airflow DAG to run a BigQuery query from Cloud Composer.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample

Python

from airflow.providers.google.cloud.operators import bigquery
from airflow.providers.google.cloud.transfers import bigquery_to_gcs
    bq_recent_questions_query = bigquery.BigQueryInsertJobOperator(
        task_id="bq_recent_questions_query",
        configuration={
            "query": {
                "query": RECENT_QUESTIONS_QUERY,
                "useLegacySql": False,
                "destinationTable": {
                        "projectId": project_id,
                        "datasetId": bq_dataset_name,
                        "tableId": bq_recent_questions_table_id
                    }
            }
        },
        location=location,
    )

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser