Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def insertFromDict(table, dict):
- """Take dictionary object dict and produce sql for
- inserting it into the named table"""
- sql = 'INSERT INTO ' + table
- sql += ' ('
- sql += ', '.join(dict)
- sql += ') VALUES ('
- sql += ', '.join(map(dictValuePad, dict))
- sql += ');'
- return sql
- def dictValuePad(key):
- return '%(' + str(key) + ')s'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement