jhamrick / dbtools

Tools for interfacing with SQLite databases
Other
34 stars 4 forks source link

Keep db connection for Table objects #13

Closed takluyver closed 10 years ago

takluyver commented 11 years ago

As discussed by e-mail, this keeps a Connection to the database with each table, rather than opening and closing it for each SQL command.

Also, using the executemany command to insert values rather than looping over them brought the test time on my machine down from about 50 seconds to about 25, because it was previously doing each row in a separate transaction.

Finally, I made the table tests use SQLite's special :memory: database, which avoids writing to disk. This brought the test run down to just over 1 second.

jhamrick commented 10 years ago

This looks great, thanks! Sorry for the delay, I'm merging it now.

takluyver commented 10 years ago

No worries. I hope you're having a good Christmas. :-)