Skip to content

Commit

Permalink
more debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
bgol committed Oct 17, 2014
1 parent 347a91c commit 1894322
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions buildcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,17 @@ def processImportFile(db, importPath, tableName, debug=0):
bindValues += [ "(SELECT {newValue} FROM {table} WHERE {table}.{column} = ?)".format(newValue=splitNames[1], table=joinTable, column=splitNames[0]) ]
# now we can make the sql statement
sql_stmt = "INSERT INTO {table}({columns}) VALUES({values})".format(table=tableName, columns=','.join(bindColumns), values=','.join(bindValues))
if debug: print("SQL-Statement: {}".format(sql_stmt))
if debug: print("* SQL-Statement: {}".format(sql_stmt))

# import the data
importCount = 0
for linein in csvin:
if len(linein) == columnCount:
if debug: print(" Values: {}".format(', '.join(linein)))
if debug > 1: print("- Values: {}".format(', '.join(linein)))
db.execute(sql_stmt, linein)
importCount += 1
db.commit()
if debug: print("* {count} {table}s imported".format(count=importCount, table=tableName))

except FileNotFoundError:
if debug:
Expand Down

0 comments on commit 1894322

Please sign in to comment.