public static void ProcessSlowlyChangingDimensionTransformations(SymbolTable symbolTable) ////HashSet<AstEtlRootNode> astEtlRootNodes, HashSet<AstTaskNode> astTaskNodes) { var snapshotSymbolTable = new List<IReferenceableItem>(symbolTable); foreach (var astNamedNode in snapshotSymbolTable) { if (astNamedNode.FirstThisOrParent<ITemplate>() == null) { var destination = astNamedNode as AstDestinationNode; if (destination != null) { if (destination.Table.HasScdColumns && !destination.DisableScd) { Utility.Replace(destination, CreateScdWorkflowFragment(destination.Table, destination.ParentItem, destination.InputPath == null ? null : destination.InputPath.OutputPath)); } } var merge = astNamedNode as AstMergeTaskNode; if (merge != null) { var sourceTable = merge.TargetConstraint.ParentItem as AstTableNode; // TODO: Must we do anything special for the UpdateTargetTable attribute? if (sourceTable != null && sourceTable.HasScdColumns && !merge.DisableScd) { var targetTable = merge.TargetConstraint.ParentItem as AstTableNode; if (targetTable == null) { continue; } var scdMergeEtl = new AstEtlRootNode(merge.ParentItem) { Name = Utility.NameCleanerAndUniqifier(merge.Name + "_scdEtl") }; // TODO: Do we need to limit query to non-computed columns? var scdMergeSource = new AstQuerySourceNode(scdMergeEtl) { Connection = sourceTable.Connection, Name = Utility.NameCleanerAndUniqifier(merge.Name + "_scdEtlSource"), Query = new AstVariableParameterMappingQueryNode(null) { Body = TableLowerer.EmitSelectAllStatement(sourceTable) } }; scdMergeSource.Query.ParentItem = scdMergeSource; scdMergeEtl.Transformations.Add(scdMergeSource); foreach (var transformation in CreateScdWorkflowFragment(targetTable, scdMergeEtl, scdMergeSource.OutputPath)) { scdMergeEtl.Transformations.Add(transformation); } } } } } }
public OleDBSource(LoweringContext context, AstNode astNode) : base(context, astNode as AstTransformationNode) { _paramDictionary = new Dictionary<string, Variable>(); _astQuerySourceNode = astNode as AstQuerySourceNode; }
private AstIR ProcessTableQuerySources(AstIR astIR) { List<AstTableNode> tables = new List<AstTableNode>(); tables.AddRange(astIR.AstRootNode.Dimensions.Cast<AstTableNode>()); tables.AddRange(astIR.AstRootNode.Facts.Cast<AstTableNode>()); tables.AddRange(astIR.AstRootNode.Tables); foreach (AstTableNode table in tables) { foreach (AstTableQuerySourceNode querySource in table.Sources.OfType<AstTableQuerySourceNode>()) { AstPackageNode package = new AstPackageNode(); package.ConstraintMode = ContainerConstraintMode.Linear; package.DefaultPlatform = PlatformType.SSIS08; package.Log = false; package.Name = querySource.Name; package.Type = "ETL"; AstStagingContainerTaskNode staging = new AstStagingContainerTaskNode(); staging.ConstraintMode = ContainerConstraintMode.Linear; staging.Log = false; staging.Name = querySource.Name; staging.CreateAs = String.Format("__Staging_{0}_{1}", table.Name, querySource.Name); staging.StagingConnection = table.Connection; staging.Table = table; AstETLRootNode etl = new AstETLRootNode(); etl.Name = String.Format("__ETL_Staging_{0}_{1}", table.Name, querySource.Name); etl.DelayValidation = true; AstQuerySourceNode source = new AstQuerySourceNode(); source.Connection = querySource.Connection; source.Name = String.Format("__ETL_Staging_Source_{0}_{1}", table.Name, querySource.Name); source.Query = querySource.Query; etl.Transformations.Add(source); AstDestinationNode destination = new AstDestinationNode(); destination.AccessMode = DestinationAccessModeFacet.TableFastLoad; destination.CheckConstraints = true; destination.TableLock = true; destination.Connection = table.Connection; destination.Name = String.Format("__ETL_Staging_Destination_{0}_{1}", table.Name, querySource.Name); destination.TableName = staging.CreateAs; destination.ValidateExternalMetadata = false; etl.Transformations.Add(destination); staging.Tasks.Add(etl); AstMergeTaskNode merge = new AstMergeTaskNode(); merge.Connection = table.Connection; merge.Name = String.Format("__Staging_Merge_{0}_{1}", table.Name, querySource.Name); merge.SourceName = staging.CreateAs; merge.TargetConstraint = table.PreferredKey; staging.Tasks.Add(merge); package.Tasks.Add(staging); astIR.AstRootNode.Packages.Add(package); } } return astIR; }