Reputation: 17
I am trying to using a python script using the "Execute Task" tool in ssis.However, i am not sure if i will be able to use one of the runtime variable inside the python script. Eg:
#inputval.py
inputval = dts.value("test").toString()
print(inputval)
Is there any chance ? . Thanks in advance for the help.
Upvotes: 0
Views: 1944
Reputation: 61211
Yes you can reference the value but not in that manner.
Python won't have access to the Variables collection so you'll have to use a different method for communication. The Execute Package Task supports either a Variable for Standard Input or for Arguments. Either one should work
Within your python script, you'll need to work with the sys.argv
collection (code approximate based on 2.7 recollections with 3.0 print flair)
for inputval in sys.argv:
print (inputval)
or skipping the first element, we'd have something like
# we can skip the first element since that is name of script
for inputval in sys.argv[1:]
print (inputval)
Upvotes: 1