I have created a file parameter for my python script. My idea is read these parameters from a JSON file and then execute wherever I need.
here is the sample file:
{
"configfiles": [
{
"log": "/home/ubuntu/scripts/mtm-etl/etl-process-log",
"connection":"/home/ubuntu/scripts/mtm-etl/etlconfig/mtm-connection",
"query_redshift_library":"/home/ubuntu/scripts/mtm-etl/etlconfig/query_redshift_library"
}
]
}
Ok, now I pretend to read these key, values in a for within my script to assign them to a variable then, here is my code:
with open('etl-parameters','r') as userinfo:
param = json.load(userinfo)
for param,extraction in param.items():
if ("ETL" in param):
for item in extraction:
process = item['etl-process']
stored_query = item['stored-query']
elif( "configfiles" in param):
for item in extraction:
logfile = item['log'],
connectionfile = item['connection'],
query_redshift_library = item['query_redshift_library']
My issue is in the elif because for one variable is being assigned the right data type as a string but for some reason for the variables logfile and connectionfile it's assigning a tuple. I have catched up this in my debug:
I appreciate your feedback
thanks

