Reputation: 3590
How to convert python array like columns = ['column1', 'column2', 'column3']
for forming SQL statement like
"Select column1, column2, column3 from table"
?
I can use join on array but don't know how to get rid of quotes of string.
Upvotes: 1
Views: 1229
Reputation: 7837
>>> 'select ' + ', '.join([c for c in columns]) + ' from table'
'select column1, column2, column3 from table'
Is that what you have in mind?
Upvotes: 2