Guest User

Untitled

a guest
Oct 18th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. CREATE TABLE T (id int, v blob);
  2. INSERT INTO T (id,v) VALUES(1, COLUMN_CREATE('color', 'blue', 'size', 'XL'));
  3.  
  4. import mysql.connector
  5. cnx = mysql.connector.connect (host=.., user=‘.., password=.., port=.., database=..)
  6. cursor = cnx.cursor()
  7. SQL='INSERT INTO T (id,v ) VALUES(%s,COLUMN_CREATE(%s))’
  8. data=[(10,'"X",2'),(20,'"Y",1')] # <---- I think problem is here
  9. cursor.executemany(SQL,data)
  10. cursor.close()
  11. cnx.commit()
  12. cnx.close()
Add Comment
Please, Sign In to add comment