Ran into a problem and something that seemed simple at first.
I want to do this (query has been dumbed down for brevity here, it's actually much longer and more complex):
query = ("""INSERT INTO %s " % cfg['mysql.table']
"('hostname', 'timestamp', 'metric', 'average', 'peakhigh', 'peaklow', 'gsamp', 'zsamp', 'nsamp')"""
"VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )"
)
So how do I incorpoarate STR_TO_DATE into this query for the timestamp field?
Thanks for any help.
Put your string inside triple quotes:
query = ("""INSERT INTO %s " % cfg['mysql.table']
"('hostname', 'timestamp', 'metric', 'average', 'peakhigh', 'peaklow', 'gsamp', 'zsamp', 'nsamp')"
"VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s )"""
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With