<s> import sys <EOL> import sqlite3 <EOL> from collections import OrderedDict <EOL> db_filename = "<STR_LIT>" <EOL> conn = sqlite3 . connect ( db_filename ) <EOL> c = conn . cursor ( ) <EOL> tbl_cols = OrderedDict ( [ ( "<STR_LIT>" , str ) , ( "<STR_LIT:start>" , int ) , <EOL> ( "<STR_LIT:end>" , int ) , ( "<STR_LIT>" , str ) , <EOL> ( "<STR_LIT>" , str ) ] ) <EOL> def record_generator ( input_file ) : <EOL> """<STR_LIT>""" <EOL> for line in input_file : <EOL> values = line . strip ( ) . split ( "<STR_LIT:\t>" ) <EOL> cols_values = zip ( tbl_cols . keys ( ) , values ) <EOL> coerced_values = [ tbl_cols [ col ] ( value ) for col , value in cols_values ] <EOL> yield coerced_values <EOL> placeholders = [ "<STR_LIT:?>" ] * len ( tbl_cols ) <EOL> colnames = "<STR_LIT:U+002CU+0020>" . join ( tbl_cols . keys ( ) ) <EOL> placeholders = "<STR_LIT:U+002CU+0020>" . join ( placeholders ) <EOL> query = "<STR_LIT>" % ( colnames , placeholders ) <EOL> input_file = open ( sys . argv [ <NUM_LIT:1> ] ) <EOL> records = record_generator ( input_file ) <EOL> c . executemany ( query , records ) <EOL> conn . commit ( ) <EOL> conn . close ( ) </s>
