Message75548
Three small changes to sqlite3 documentation:
1) (mostly cosmetic) In the second example, changed what was "a tuple
of tuples" to "a list of tuples" to follow common practice.
2) "DEFERRED", "IMMEDIATE" and "EXLUSIVE" (possible values for
Connection.isolation_level) are strings, not module constants, so
should be surrounded with quotes.
2) The iterdump example is not well written. Currently says:
con = sqlite3.connect('existing_db.db')
full_dump = os.linesep.join(con.iterdump())
f = open('dump.sql', 'w')
f.writelines(full_dump)
f.close()
Using os.linesep to join lines to be written to a text file has strange
results in non-Unix systems; joining the *whole* database dump into a
big string isn't a good idea; and finally, writelines(some_string) will
write the text one char at a time (!).
I've rewritten it as:
with open('dump.sql', 'w') as f:
for line in con.iterdump():
f.write('%s\n' % line)
to take advantage of iterdump's lazy nature. |
|
Date |
User |
Action |
Args |
2008-11-06 07:48:17 | ggenellina | set | recipients:
+ ggenellina, georg.brandl |
2008-11-06 07:48:17 | ggenellina | set | messageid: <1225957697.4.0.46686050905.issue4267@psf.upfronthosting.co.za> |
2008-11-06 07:48:16 | ggenellina | link | issue4267 messages |
2008-11-06 07:48:15 | ggenellina | create | |
|