如何使用 Python 为 Azure 数据资源管理器使用动态路由属性

How to make use of dynamic routing properties using Python for Azure Data Explorer

在 Azure-Data-Explorer 中,创建数据连接时有一个名为我的 table 数据包含路由信息的选项。我如何使用 python 使用它?在 Azure Samples(https://github.com/Azure-Samples/event-hubs-dotnet-ingest/blob/master/EventHubSampleData/EventHub2/Program.cs) 中,他们使用 csharp 添加路由属性。我如何在 python 中实现相同的目标?

client = EventHubClient(ADDRESS, debug=False, username=USER, password=KEY)
sender = client.add_sender(partition="0")
client.run()
try:
    start_time = time.time()
    employess = [
        {
            "empid": 10,
            "name":"Samir",
            "age": 25
        }
    ]
    for i in employess:
        print("Sending Employee: {}".format(json.dumps(i)))

        sender.send(EventData(json.dumps(i)))
except:
    raise

github中有一个python代码示例:

data = {}
tableName = 'TestTable'
tableMapping = 'TestMapping'

event = EventData(json.dumps(data).encode('UTF-8'))
event.application_properties = {
    'Table': tableName,
    'Format': "json",
    'IngestionMappingReference': tableMapping,
}
sender.send(event)

如果不符合您的需要,请随时修改示例。