From 7f8ac7ae256c179e4b80e3cb1fdcf837f2ce8f10 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Mon, 27 Sep 2021 17:44:03 +0200 Subject: [PATCH] [skip changelog] Add missing partitioning query in Athena script --- .github/tools/fetch_athena_stats.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/tools/fetch_athena_stats.py b/.github/tools/fetch_athena_stats.py index 771f68c8117..047585538ba 100644 --- a/.github/tools/fetch_athena_stats.py +++ b/.github/tools/fetch_athena_stats.py @@ -18,7 +18,6 @@ def execute(client, statement, dest_s3_output_location): result = client.start_query_execution( QueryString=statement, ClientRequestToken=str(uuid.uuid4()), - QueryExecutionContext={"Database": "etl_kpi_prod_hwfw"}, ResultConfiguration={ "OutputLocation": dest_s3_output_location, }, @@ -113,6 +112,9 @@ def convert_data(data): session = boto3.session.Session(region_name="us-east-1") athena_client = session.client("athena") + # Load all partitions before querying downloads + execute(athena_client, f"MSCK REPAIR TABLE {AWS_ATHENA_SOURCE_TABLE};", DEST_S3_OUTPUT) + query = f"""SELECT replace(json_extract_scalar(url_decode(url_decode(querystring)), '$.data.url'), 'https://downloads.arduino.cc/arduino-cli/arduino-cli_', '') AS flavor, count(json_extract(url_decode(url_decode(querystring)),'$')) AS gauge