Created
December 24, 2020 15:06
-
-
Save joshdemir/d31296982a9e5eddd533dbfc4b676bfe to your computer and use it in GitHub Desktop.
Asynchronous Azure Table PointQueries in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from azure.data.tables import TableClient | |
client = TableClient.from_connection_string(conn_str='foo', table_name='bar') | |
async def run_query(partition_key, row_key): | |
return client.query_entity(partition_key, row_key) | |
async def gather_queries(partition_key, row_key_base, substitutions): | |
return asyncio.gather(*[run_query(partition_key, row_key % subst) for subst in substitutions]) | |
substitutions = ['1', '2', '3', '4', '5'] | |
partition_key = 'partition_key' | |
row_key_base = 'rowkey_%s' | |
results = asyncio.run(gather_queries(partition_key, row_key, substitutions)).result() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment