I have a long string like:
cmd = "python %sbin/datax.py -p '-Drun=%s -Drpwd=%s -Drjdbc=%s -Dcond=%s -Dtable=%s \
-Dwun=%s -Dwpwd=%s -Dwjdbc=%s' %s" % ( DATAX_HOME,
rds_reader['username'],
rds_reader['password'],
sub_jdbc_url_generator(args.reader),
where_condition,
args.table,
rds_writer['username'],
rds_writer['password'],
sub_jdbc_url_generator(args.writer),
job_template_file)
I do not want to put all -D
s in one row because that looks too long and the codes above works actually, but it returns:
python /tmp/datax/bin/datax.py -p '-Drun=xxx ... -Dtable=demo -Dwun=yyy ...'
It has a long space inside the result. I also read some questions but this string contains some %s
to be filled up.
So how to tackle this issue? Or is it other elegant way to write? Any help is appreciated.
The expected output:
python /tmp/datax/bin/datax.py -p '-Drun=xxx ... -Dtable=demo -Dwun=yyy ...'