Skip to content

Instantly share code, notes, and snippets.

@dews
Created February 9, 2018 03:04
Show Gist options
  • Save dews/5202e680fcfaf8da072f5e8d8f08d642 to your computer and use it in GitHub Desktop.
Save dews/5202e680fcfaf8da072f5e8d8f08d642 to your computer and use it in GitHub Desktop.
Fill the SQLite
import sqlite3
conn = sqlite3.connect('testDB.db')
cursor = conn.cursor()
# cursor.execute('''CREATE TABLE test5
# (ID INT PRIMARY KEY NOT NULL,
# NAME TEXT NOT NULL);''')
with open('1mb.img') as f:
readFile = f.read()
i = 11
while i < 1000:
cursor.execute('''INSERT INTO test5 VALUES (?, ?)''',(i, readFile))
conn.commit()
i = i + 1
print(conn.total_changes)
@dews
Copy link
Author

dews commented Feb 9, 2018

$ fallocate -l 1M 1mb.img

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment