Created
November 26, 2017 07:12
-
-
Save bosukh/6e6a9b06c3239ec2553388586e82d2d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import time | |
| def test_raw_update(n=100000): | |
| init_sqlalchemy(False) | |
| t0 = time.time() | |
| f = open('customers_to_insert', 'w') | |
| for i in xrange(1, n+1): | |
| f.write( | |
| "{0},{1}\n".format( | |
| i, 'NEW_NAME ' + str(i) | |
| ) | |
| ) | |
| f.close() | |
| os.system( | |
| './raw_update_script.sh \ | |
| {file_name} {table_name} {db_name} {username} {password}'.format( | |
| file_name = 'customers_to_insert', | |
| table_name = 'customer', | |
| db_name = 'example', | |
| username = 'example', | |
| password = 'example_password' | |
| ) | |
| ) | |
| os.remove('./customers_to_insert') | |
| print( | |
| "mysql raw update: Total time for " + str(n) + | |
| " records " + str(time.time() - t0) + " sec") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment