예제 #1
0
파일: Program.cs 프로젝트: wyhiswys/Tx
        static void ResetTable(KustoConnectionStringBuilder kscb, string tableName, Type type)
        {
            using (var admin = KustoClientFactory.CreateCslAdminProvider(kscb))
            {
                string dropTable = CslCommandGenerator.GenerateTableDropCommand(tableName, true);
                admin.ExecuteControlCommand(dropTable);

                string createTable = CslCommandGenerator.GenerateTableCreateCommand(tableName, type);
                admin.ExecuteControlCommand(createTable);

                string enableIngestTime = CslCommandGenerator.GenerateIngestionTimePolicyAlterCommand(tableName, true);
                admin.ExecuteControlCommand(enableIngestTime);
            }
        }
예제 #2
0
        private void CreateMergeKustoTable(ICslAdminProvider admin, IDictionary <string, object> value)
        {
            TableSchema tableSchema = new TableSchema(TableName);

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

            string createTable = CslCommandGenerator.GenerateTableCreateMergeCommand(tableSchema);

            admin.ExecuteControlCommand(createTable);

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

            admin.ExecuteControlCommand(enableIngestTime);
        }