Skip to content

Instantly share code, notes, and snippets.

@darkblue-b
Created October 28, 2014 00:35
Show Gist options
  • Save darkblue-b/39a26e8915ad42766ff8 to your computer and use it in GitHub Desktop.
Save darkblue-b/39a26e8915ad42766ff8 to your computer and use it in GitHub Desktop.
import psycopg2
import time
conn = psycopg2.connect("dbname=text_test0")
curs = conn.cursor()
base_chars = ( 'A','C','G','T','U')
base_strs_t = (
'AACGTAACGTAACGTAACGTAACGTAACGTAACGTAACGT',
'UGUTCUGUTCUGUTCUGUTCUGUTCUGUTCUGUTCUGUTC',
'TTAUGTTAUGTTAUGTTAUGTTAUGTTAUGTTAUGTTAUG',
'AUGGUTTCAAAUGGUTTCAAAUGGUTTCAAAUGGUTTCAA',
'UTCCATTUGGATCCATTUGGATCCATTUGGATCCATTUGA',
'CCACCAAAACACAACCCCACCACAACACAACAACAAACAA',
'TTCATTCATTTCCCTAAATCCCTATTTAAACCCCAAATTT',
'GGGUGGGGGUUUUGGGGGUGUGUGGGUGUGUGUGUUGUGG',
'ACGGGACCCGAGGAGGCCACCTCCAGGAGAAAGAACCCCG',
'UUTTTUUUTTUUCUUUTTUTCCCCACCACCACCAAACAAC'
)
def get_time_int() :
return str( int( time.time()) )
ins_sql = '''INSERT into build0 (testfield) VALUES (%s)'''
def do_some_ins() :
t_str = get_time_int()
for elem in t_str:
curs.execute( ins_sql, [ base_strs_t[ int(elem) ] ] )
conn.commit()
##-- build 40m strings, 10 at a time
t_cnt = 0
while True :
t_cnt += 1
do_some_ins()
if t_cnt > 4000000:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment