def do_job()

in backfill/2024-04-29-fxa_events/backfill_accounts_backend_events_v1.py [0:0]


def do_job(current_date):
    current_partition = current_date.strftime('%Y%m%d')
    current_date_str = current_date.strftime('%Y-%m-%d')

    dest_table = f"events_v1${current_partition}"

    arguments = (
            ['query', '--use_legacy_sql=false', '--replace', '--project_id=moz-fx-data-shared-prod',
             '--format=none', f'--parameter=submission_date:DATE:{current_date_str}', '--dry_run']
            + [f'--dataset_id=moz-fx-data-shared-prod:accounts_backend_stable']
            + [f'--destination_table={dest_table}']
    )

    print(f"Running backfill to {dest_table}")

    with open('convert_backend.sql', 'r') as file:
        subprocess.check_call(["bq"] + arguments, stdin=file)