def get_batch_file_metadata()

in spark_scripts/synchronize_topics.py [0:0]


def get_batch_file_metadata(table_name, batch_id):
    dynamodb = boto3.resource("dynamodb", region_name="eu-west-1")
    table = dynamodb.Table(table_name)
    response = table.query(
        KeyConditions={
            "BatchId": {"AttributeValueList": [batch_id], "ComparisonOperator": "EQ"}
        }
    )
    data = response["Items"]
    while "LastEvaluatedKey" in response:
        response = table.query(ExclusiveStartKey=response["LastEvaluatedKey"])
        data.update(response["Items"])
    return data