Exemplo n.º 1
0
        private void CreateMergeKustoTable(ICslAdminProvider admin, IDictionary <string, object> value)
        {
            TableSchema tableSchema = new TableSchema(_table);

            foreach (var pair in value)
            {
                if (pair.Value != null && !_columnType.ContainsKey(pair.Value.GetType()))
                {
                    tableSchema.AddColumnIfMissing(new ColumnSchema(pair.Key, typeof(JToken).ToString()));
                }
                else
                {
                    tableSchema.AddColumnIfMissing(new ColumnSchema(pair.Key, _columnType[pair.Value != null ? pair.Value.GetType() : typeof(JToken)]));
                }
            }

            string createTable = CslCommandGenerator.GenerateTableCreateMergeCommand(tableSchema);

            admin.ExecuteControlCommand(createTable);

            string enableIngestTime = CslCommandGenerator.GenerateIngestionTimePolicyAlterCommand(_table, true);

            admin.ExecuteControlCommand(enableIngestTime);
        }