I'm trying to insert some strings from an array of strings using string formatting.
But for some reason, Python is filling the first %s with the desired string but surrounded by single quotes.
Is there an explicit way to prevent this behavior?
Example:
myString = [['000b',
'1',
'Text1',
'1.74',
'Text2',
'None'],
['000b',
'1',
'TextA',
'12.92',
'TextB',
'None']]
When I run the following:
cursor.executemany("INSERT INTO schema.myTable_%s_name (col1, col2, col3, col4, col5) VALUES (%s, NULLIF(%s,'None')::decimal, NULLIF(%s,'None')::decimal, %s, NULLIF(%s,'None')::int)", myString[0:len(myString)])
the expected behavior is that the table name becomes schema.myTable_000b_name but Python writes schema.myTable_'000b'_name which naturally prevents the SQL from running. How could I specify that I don't want the single quotes to be inserted?