[New-bugs-announce] [issue4267] sqlite3 documentation

Gabriel Genellina report at bugs.python.org
Thu Nov 6 08:48:17 CET 2008


New submission from Gabriel Genellina <gagsl-py2 at yahoo.com.ar>:

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.

----------
assignee: georg.brandl
components: Documentation
files: sqlite3.diff
keywords: patch
messages: 75548
nosy: gagenellina, georg.brandl
severity: normal
status: open
title: sqlite3 documentation
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file11949/sqlite3.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4267>
_______________________________________


More information about the New-bugs-announce mailing list