in modules/python/kusto/generate_commands.py [0:0]
def generate_kusto_commands(data, table_name):
# Create table command
table_command = f".create table ['{table_name}'] ("
for key, value in data.items():
infered_type = infer_type(value)
table_command += f"['{key}']:{infered_type}, "
table_command = table_command.rstrip(", ") + ")"
# Create table ingestion json mapping command
mapping_command = f".create table ['{table_name}'] ingestion json mapping '{table_name}_mapping' '["
for key in data.keys():
mapping_command += f"{{\"column\":\"{key}\", \"Properties\":{{\"Path\":\"$[\\'{key}\\']\"}}}},"
mapping_command = mapping_command.rstrip(", ") + "]'"
kusto_commands = f"{table_command}\n\n{mapping_command}"
return kusto_commands