BIML 启用 SSIS 包配置

BIML enable SSIS Package Configuration

我正在尝试使用 BIML 生成 SSIS 包。在该包中必须启用包配置(如下图所示)。所以这个包使用一个现有的配置文件(选项:重新使用exsising)。

我正在使用以下版本:

我尝试使用以下代码:

PackageConfiguration部分

 <!-- SET PACKAGE CONFIGURATION (DOES NOT WORK YET!!! )  -->       
    <PackageConfigurations>
        <PackageConfiguration Name="ADWHConfig">
          <ExternalFileInput ExtrnalFilePath="D:\ADWH\SSIS_ConfigFiles\ADWHConfig.dtsConfig">    
          </ExternalFileInput>
       </PackageConfiguration>
    </PackageConfigurations>

完整脚本

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
    <#
        var cod_process = "80010007";
        var strDestenationTable =" BLA_BLA";
    #>

    <Connections>
        <OleDbConnection Name="LocalHost.ADWH01.dwh_user"
                         ConnectionString="Data Source=.;User ID=dwh_user;Initial Catalog=ADWH01;Provider=SQLNCLI11.1;database=ADWH01;Password=dbadmin_dwh;"
                         CreatePackageConfiguration="false">
        </OleDbConnection>
    </Connections>

    <Packages>
        <Package Name="TEST" ConstraintMode="Linear" >
            <Variables>
                <Variable Name="COD_INSTANCE" DataType="Int64">0</Variable>
                <Variable Name="COD_PROCESS" DataType="Int64">0</Variable>
                <Variable Name="ROW_COUNT" DataType="Int32">0</Variable>
                <Variable Name="COD_PROCESS_STATUS" DataType="String"></Variable>

                <!-- SET VARIABLES LOAD CALENDER -->
                <Variable Name="LOAD_STRATEGY" DataType="String"></Variable>
                <Variable Name="LOAD_CALENDER" DataType="Object"></Variable>
                <Variable Name="FirstDayOfPeriod" DataType="DateTime">1/1/1900</Variable>
                <Variable Name="LastDayOfPeriod" DataType="DateTime">1/1/1900</Variable>

                <!-- SET VARIABLES LOAD SNAPSHOT -->
                <Variable Name="LOAD_SNAPSHOTS" DataType="Object"></Variable>
                <Variable Name="M_UTC_SNAPSHOT" DataType="DateTime">1/1/1900</Variable>
                <Variable Name="M_COD_SOR" DataType="Int64">0</Variable>
            </Variables>

            <!-- SET PACKAGE CONFIGURATION (DOES NOT WORK YET!!! )  -->
            <PackageConfigurations>
                <PackageConfiguration Name="ADWHConfig">
                    <ExternalFileInput ExternalFilePath="D:\ADWH\SSIS_ConfigFiles\ADWHConfig.dtsConfig"></ExternalFileInput>
                </PackageConfiguration>
            </PackageConfigurations>

            <Tasks>
                <Dataflow Name="TEST 123">
                    <Transformations>
                        <OleDbSource Name="SNAPSHOT" ConnectionName="LocalHost.ADWH01.dwh_user">
                            <ExternalTableInput Table="DSAOMA.SNAPSHOT_D_KREDIETOVEREENKOMST2"></ExternalTableInput>
                            <Columns>
                                <Column SourceColumn="M_UTC_START" TargetColumn="M_UTC_START"></Column>
                                <Column SourceColumn="M_UTC_END" TargetColumn="M_UTC_END"></Column>
                                <Column SourceColumn="IDC_CONTRACT" TargetColumn="IDC_KREDIET_CONTRACT"></Column>
                                <Column SourceColumn="AFSCHRIJVINGSCODE_EWO_WOT" TargetColumn="AFSCHRIJVINGSCODE_EWO_WOT"></Column>
                                <Column SourceColumn="CONTRACTNUMMER" TargetColumn="ContractNummer"></Column>
                                <Column SourceColumn="DATUM_AANKOOP_KREDIET" TargetColumn="Datum_Aankoop_Krediet"></Column>
                                <Column SourceColumn="RISICOKLASSE" TargetColumn="Risicoklasse"></Column>
                                <Column SourceColumn="PROVISIEKLASSE" TargetColumn="Provisieklasse"></Column>
                            </Columns>
                        </OleDbSource>
                        <DerivedColumns Name="EXPRIndicatie_EWO_WOT">
                            <Columns>
                                <Column Name="Indicatie_EWO_WOT" DataType="VarNumeric" ReplaceExisting="false">!ISNULL(AFSCHRIJVINGSCODE_EWO_WOT) ? (DT_WSTR, 255)"J" :(DT_WSTR, 255) "N"</Column>
                            </Columns>
                            <InputPath OutputPathName="SNAPSHOT.Output"></InputPath>                    
                        </DerivedColumns>
                    </Transformations>
                </Dataflow>
            </Tasks>
        </Package>
</Packages>
</Biml>

但是当我生成包时这不起作用。请你能帮我解决这个问题吗?我通过关注网站 http://www.cathrinewilhelmsen.net/2014/06/17/package-configurations-and-connection-managers-in-biml/ 来尝试实现这一点。

我精简了你的 Biml,但能够很好地生成一个包。它没有做什么,也许这是你的问题,它实际上并没有创建 .dtsconfig 文件。那是你的责任。

这是我的示例 dtsconfig

<?xml version="1.0"?>
<DTSConfiguration>
    <DTSConfigurationHeading>
        <DTSConfigurationFileInfo GeneratedBy="billinkc" GeneratedFromPackageName="so_37936760" GeneratedFromPackageID="{7E71E2C4-B411-4CF7-9A18-30A021832B5B}" GeneratedDate="6/21/2016 8:07:55 AM"/>
    </DTSConfigurationHeading>
    <Configuration ConfiguredType="Property" Path="\Package.Variables[User::COD_INSTANCE].Properties[Value]" ValueType="Int64">
        <ConfiguredValue>1</ConfiguredValue>
    </Configuration>
</DTSConfiguration>

我只是将值 1 分配给 COD_INSTANCE 变量的值 属性。

BIDS Helper 让我知道这个变量有一个配置,方法是将一个角涂成蓝色

我的 biml 版本只更改了属性以匹配我的本地机器(并且我删除了数据流的主体),配置的内容保持不变。

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
        <Connections>
        <OleDbConnection Name="LocalHost.ADWH01.dwh_user"
            ConnectionString="Data Source=localhost\dev2014;Initial Catalog=tempdb;Provider=SQLNCLI11.0;Integrated Security=SSPI;"
            CreatePackageConfiguration="false">
        </OleDbConnection>
    </Connections>
    <Packages>
        <Package Name="so_37936760" ConstraintMode="Linear" >

            <Variables>
                <Variable Name="COD_INSTANCE" DataType="Int64">0</Variable>
                <Variable Name="COD_PROCESS" DataType="Int64">0</Variable>
                <Variable Name="ROW_COUNT" DataType="Int32">0</Variable>
                <Variable Name="COD_PROCESS_STATUS" DataType="String"></Variable>

                <!-- SET VARIABLES LOAD CALENDER -->
                <Variable Name="LOAD_STRATEGY" DataType="String"></Variable>
                <Variable Name="LOAD_CALENDER" DataType="Object"></Variable>
                <Variable Name="FirstDayOfPeriod" DataType="DateTime">1/1/1900</Variable>
                <Variable Name="LastDayOfPeriod" DataType="DateTime">1/1/1900</Variable>

                <!-- SET VARIABLES LOAD SNAPSHOT -->
                <Variable Name="LOAD_SNAPSHOTS" DataType="Object"></Variable>
                <Variable Name="M_UTC_SNAPSHOT" DataType="DateTime">1/1/1900</Variable>
                <Variable Name="M_COD_SOR" DataType="Int64">0</Variable>
            </Variables>

            <!-- SET PACKAGE CONFIGURATION (DOES NOT WORK YET!!! )  -->
            <PackageConfigurations>
                <PackageConfiguration Name="ADWHConfig">
                    <ExternalFileInput ExternalFilePath="c:\ssisdata\so\so_37936760.dtsConfig"></ExternalFileInput>
                </PackageConfiguration>
            </PackageConfigurations>

            <Tasks>
                <Dataflow Name="TEST 123">

                </Dataflow>
            </Tasks>
        </Package>
</Packages>    
</Biml>

无论我是在包部署模型还是项目部署模型中,结果都是一样的——这让我很惊讶。我认为项目部署模型会阻止使用包配置的能力。

嗯...我的 BIML 文件效果很好,像上面那样设置...

但是...当我打开生成的.dtsx文件时,没有

(VS 2013 shell,BIDS 助手 1.7.0,SSIS 设计器 12.0.2430.0)