Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

Run a child package with its own configuration file from a parent SSIS package Expand / Collapse
Author
Message
Posted Friday, February 19, 2010 10:25 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 247, Visits: 703
I have child package I wish to call from a parent package. The child package runs off a configuration file. Assuming I have to put an execute package in to the parent package to call the child, how do I attach a particular configuration file to the child package? I need the child package to be runnable on its own too, hence the need for it to have its own configuration file.
Post #869250
Posted Monday, February 22, 2010 1:35 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
I'm not sure I fully understand your question, but here's nonetheless a first attempt at answering it.

You are right that you will need an execute package task to run the child package from its parent.

In the child package, you should use package configurations. The important thing to know here is that package configurations can set a variable or property multiple times where the last setting wins. If a configuration fails (either because the variable or property it is trying to set does not exist or - in the case of a configuration of type "Parent Package Variable" - the parent package variable does not exist), this will give a warning but this will not hinder your package executing.

If the configurations are the same for both packages, you could use the same configuration file (or same configuration filter in case your configurations are stored in a database) for the child and the parent package.

If the configurations are different, you have several options:

- use different configuration files (one for the parent and one for the child)
- use the parent configuration file in both packages, but then overwrite some values with settings specific to the child package using a second configuration file that is specific to the child and that is read after the first one

If the settings in the child package are different depending on whether it is executed on its own or called from the parent package, you would do as above, but add a final configuration where you overwrite some values using Parent Package Variables. If the child package is executed on its own, the parent variables are not defined and this step will have no effect (you will see a warning though).

PS: You can turn these warnings off, but you are discouraged to do this in a production environment.


Regards,

Willem
http://wschampheleer.wordpress.com
Post #870126
Posted Monday, February 22, 2010 4:06 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 247, Visits: 703
wschampheleer (2/22/2010)
I'm not sure I fully understand your question, but here's nonetheless a first attempt at answering it.

You are right that you will need an execute package task to run the child package from its parent.

In the child package, you should use package configurations. The important thing to know here is that package configurations can set a variable or property multiple times where the last setting wins. If a configuration fails (either because the variable or property it is trying to set does not exist or - in the case of a configuration of type "Parent Package Variable" - the parent package variable does not exist), this will give a warning but this will not hinder your package executing.


Ok, understood. However, if I'm setting up a child package to be run via an execute package task in the parent, I don't get the option to use a particular configuration file. If the parent package overrides the child package then that's fine, I'll just place the same variables in my parent package and place them in the parent's configuration file.

If the configurations are the same for both packages, you could use the same configuration file (or same configuration filter in case your configurations are stored in a database) for the child and the parent package.

If the configurations are different, you have several options:

- use different configuration files (one for the parent and one for the child)
- use the parent configuration file in both packages, but then overwrite some values with settings specific to the child package using a second configuration file that is specific to the child and that is read after the first one.


Think I see what you mean here, however, as I can't see how you can apply a configuration file in an execute package task how do you apply the different configuration file to the child? Could it be that in the parent, when you set up package configuration files in the parent (SSIS > Package Configurations...) that you add them in there in order you want them to apply? e.g. if you had a configuration file for the child setting variable var1, and the parent package configuration file sets values for variables var1, var2, var3, then you place two configuration files in there, one for var1 in child and the second to be var1 to var3 in the parent. The var1 in the second configuration (parent) file overwriting the var1 in the first (child config) file?


If the settings in the child package are different depending on whether it is executed on its own or called from the parent package, you would do as above, but add a final configuration where you overwrite some values using Parent Package Variables. If the child package is executed on its own, the parent variables are not defined and this step will have no effect (you will see a warning though).

PS: You can turn these warnings off, but you are discouraged to do this in a production environment.

Post #870210
Posted Monday, February 22, 2010 4:26 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
You can use package configurations in both the parent and the child package independently. The configurations for the child package should be defined in that package, not in the parent package or through the execute package task (which is indeed not possible).

Regards,

Willem
http://wschampheleer.wordpress.com
Post #870223
Posted Monday, February 22, 2010 6:19 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 247, Visits: 703
wschampheleer (2/22/2010)
You can use package configurations in both the parent and the child package independently. The configurations for the child package should be defined in that package, not in the parent package or through the execute package task (which is indeed not possible).


Sorry, I wasn't being clear I think. My current scenario is this:

I have a package which uses a particular configuration file. This has been running independently as two separate sql agent job for a number of months now. There are two separate jobs as one uses the original configuration file as set up in BIDS, and the other uses another file with different values.

I now have another package (the parent) which, as part of its run, needs to run the above package (the child).

I'm currently in development of the parent, but it's highly likely I will have other variables that I need to add to the parent package's configuration file.

Are you saying that, if I wanted the child package to run with different values to those in the child's original package configuration file setup in BIDS, then I need to add the same variable names in to my parent package as in my child configuration file and these will filter down in to the child when it runs as part of the parent?
Post #870281
Posted Monday, February 22, 2010 6:48 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
You can reuse the child's configuration file in the parent and then add extra configurations in the parent package (e.g. you can have more than 1 configuration file in a package; if a value or property is set more than once, the latest setting wins).

The configurations will not filter down from parent to child. If you want this to happen, then you need to define configurations of the type "Parent Package Variable" in the child. The name of the variable does not have to be the same in both packages.


Regards,

Willem
http://wschampheleer.wordpress.com
Post #870307
Posted Monday, February 22, 2010 8:12 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 247, Visits: 703
wschampheleer (2/22/2010)
You can reuse the child's configuration file in the parent and then add extra configurations in the parent package (e.g. you can have more than 1 configuration file in a package; if a value or property is set more than once, the latest setting wins).

The configurations will not filter down from parent to child. If you want this to happen, then you need to define configurations of the type "Parent Package Variable" in the child. The name of the variable does not have to be the same in both packages.


Mmm. If I change the package configuration for the child to be parent package variable in BIDS, won't this then mean that I cannot run the child independently?
Post #870378
Posted Monday, February 22, 2010 8:51 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, October 9, 2014 1:02 PM
Points: 6,032, Visits: 5,284
You need to be careful reusing configuration files, if the file refers to an object that does not exist in BOTH packages then it throws an error (or might be an error, can't remember), but it throws something so I didn't ever share. Any data that the child package needed was passed from Parent Package Variables.

CEWII
Post #870427
Posted Monday, February 22, 2010 9:00 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 7:06 AM
Points: 247, Visits: 703
Where do you set up the parent package variable in configuration files? In the child via BIDS or the parent?
Post #870439
Posted Monday, February 22, 2010 9:12 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, February 19, 2013 2:02 AM
Points: 846, Visits: 303
In the child via BIDS.

Regards,

Willem
http://wschampheleer.wordpress.com
Post #870458
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse