private static void BuildInsertPath(AstTableNode targetTable, IFrameworkItem parentItem, List <AstTransformationNode> workflowFragment, AstDataflowOutputPathNode scdInsertPath) { var insertTransform = new AstDerivedColumnListNode(parentItem) { Name = Utility.NameCleanerAndUniqifier(targetTable.Name + "_InsertDerivedColumns") }; insertTransform.InputPath = new AstDataflowMappedInputPathNode(insertTransform) { OutputPath = scdInsertPath }; insertTransform.Columns.Add(new AstDerivedColumnNode(insertTransform) { Name = "_scdFrom", Expression = "(DT_DBTIMESTAMP2,7)(@[System::StartTime])", Scale = 7, DerivedColumnType = ColumnType.DateTime2, ReplaceExisting = false }); insertTransform.Columns.Add(new AstDerivedColumnNode(insertTransform) { Name = "_scdTo", Expression = "NULL(DT_DBTIMESTAMP2,7)", Scale = 7, DerivedColumnType = ColumnType.DateTime2, ReplaceExisting = false }); workflowFragment.Add(insertTransform); var insertDestination = new AstDestinationNode(parentItem); insertDestination.Table = targetTable; insertDestination.DisableScd = true; insertDestination.ValidateExternalMetadata = false; insertDestination.Name = Utility.NameCleanerAndUniqifier(targetTable.Name + "_InsertDestination"); workflowFragment.Add(insertDestination); }
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); }
public OleDBDestination(LoweringContext context, AstNode astNode) : base(context, astNode as AstTransformationNode) { _astDestination = astNode as AstDestinationNode; RegisterInputBinding(_astDestination); }