Esempio n. 1
0
        public static void SetDefaultPartition(BimDTO.Table table, SqlTable sqlTable, string database, string server = null)
        {
            var partition = new BimDTO.Partition()
            {
                Name     = "Partition",
                DataView = "full",
            };

            SetDefaultPartitionSource(partition, sqlTable, database, server);

            table.Partitions.Add(partition);
        }
Esempio n. 2
0
        public static void SetDefaultPartitionSource(BimDTO.Partition partition, SqlTable sqlTable, string database, string server = null)
        {
            var partitionSource = new BimDTO.PartitionSource
            {
                Type = "m"
            };

            partitionSource.Expression.Add("let");
            // TODO SQL
            partitionSource.Expression.Add($"    Source = #\"SQL/{server ?? "localhost"};{database}\",");
            partitionSource.Expression.Add($"    {sqlTable.SchemaAndTableName.Schema}_{sqlTable.SchemaAndTableName.TableName} = Source{{[Schema =\"{sqlTable.SchemaAndTableName.Schema}\",Item=\"{sqlTable.SchemaAndTableName.TableName}\"]}}[Data]");
            partitionSource.Expression.Add("in");
            partitionSource.Expression.Add($"     {sqlTable.SchemaAndTableName.Schema}_{sqlTable.SchemaAndTableName.TableName}");

            partition.Source = partitionSource;
        }