-
-
Save lopesivan/df97934122d8dd0bcf2ce087ff1d897b 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 sqlite3 | |
import os | |
from itertools import cycle, product | |
DB_FILE = "data.sqlite3" | |
num_rows = 100000000 | |
elements = cycle(product(["name1", "name2", "name3"], [1,2,3])) | |
conn = sqlite3.connect(DB_FILE) | |
curs = conn.cursor() | |
curs.execute("CREATE TABLE test (name string, val integer);") | |
curs.executemany("INSERT INTO test (name, val) VALUES (?, ?)", | |
[next(elements) for row in range(num_rows)]) | |
conn.commit() | |
curs.execute("select count(*) from test") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment