Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector
- insert_sql = ("INSERT INTO table (Value) VALUES (%s)")
- for i in range(100):
- cnx = mysql.iconnector.connect(user='root', password='password', host='127.0.0.1', database='database')
- cursor = cnx.cursor()
- # Insert 50000 rows here
- for j in range(50000):
- cursor.execute(insert_sql, (j,))
- cnx.commit()
- cursor.close()
- cnx.close()
- print('Finished processing one file')
- print('All done')
- CREATE TABLE `table` (
- `Id` int(11) NOT NULL AUTO_INCREMENT,
- `Value` int(11) NOT NULL,
- PRIMARY KEY (`EventId`)
- )
Add Comment
Please, Sign In to add comment