)
        # [END howto_operator_bigquery_check]

        # [START howto_operator_bigquery_value_check]
        check_value = BigQueryValueCheckOperator(
            task_id="check_value",
            sql=f"SELECT COUNT(*) FROM {DATASET_NAME}.{TABLE_1}",
            pass_value=4,
            use_legacy_sql=False,
            location=location,
        )
        # [END howto_operator_bigquery_value_check]

        # [START howto_operator_bigquery_interval_check]
        check_interval = BigQueryIntervalCheckOperator(
            task_id="check_interval",
            table=f"{DATASET_NAME}.{TABLE_1}",
            days_back=1,
            metrics_thresholds={"COUNT(*)": 1.5},
            use_legacy_sql=False,
            location=location,
        )
        # [END howto_operator_bigquery_interval_check]

        [create_table_1, create_table_2] >> insert_query_job >> select_query_job

        insert_query_job >> execute_insert_query
        execute_insert_query >> get_data >> get_data_result >> delete_dataset
        execute_insert_query >> execute_query_save >> bigquery_execute_multi_query >> delete_dataset
        execute_insert_query >> [check_count, check_value, check_interval] >> delete_dataset
Beispiel #2
0
    # [END howto_operator_bigquery_check]

    # [START howto_operator_bigquery_value_check]
    check_value = BigQueryValueCheckOperator(
        task_id="check_value",
        sql="SELECT COUNT(*) FROM {}.save_query_result".format(DATASET_NAME),
        pass_value=1000,
        use_legacy_sql=False,
    )
    # [END howto_operator_bigquery_value_check]

    # [START howto_operator_bigquery_interval_check]
    check_interval = BigQueryIntervalCheckOperator(
        task_id="check_interval",
        table="{}.save_query_result".format(DATASET_NAME),
        days_back=1,
        metrics_thresholds={'COUNT(*)': 1.5},
        use_legacy_sql=False,
    )
    # [END howto_operator_bigquery_interval_check]

    create_dataset >> execute_query_save >> delete_dataset
    create_dataset >> get_empty_dataset_tables >> create_table >> get_dataset_tables >> delete_dataset
    create_dataset >> get_dataset >> delete_dataset
    create_dataset >> patch_dataset >> update_dataset >> delete_dataset
    execute_query_save >> get_data >> get_dataset_result
    get_data >> delete_dataset
    create_dataset >> create_external_table >> execute_query_external_table >> \
        copy_from_selected_data >> delete_dataset
    execute_query_external_table >> bigquery_to_gcs >> delete_dataset
    create_table >> create_view >> delete_view >> delete_table >> delete_dataset