[Python-checkins] r62000 - in python/trunk: Doc/library/sqlite3.rst Lib/test/test_sqlite.py Misc/ACKS Misc/NEWS Modules/_sqlite/connection.c
Georg Brandl
g.brandl at gmx.net
Fri Mar 28 10:22:36 CET 2008
gregory.p.smith schrieb:
> Author: gregory.p.smith
> Date: Fri Mar 28 09:32:09 2008
> New Revision: 62000
>> Modified:
> python/trunk/Doc/library/sqlite3.rst
> python/trunk/Lib/test/test_sqlite.py
> python/trunk/Misc/ACKS
> python/trunk/Misc/NEWS
> python/trunk/Modules/_sqlite/connection.c
> Log:
> Accept patch issue2426 by Paul Kippes (kippesp).
>> Adds sqlite3.Connection.iterdump to allow dumping of databases.
>>> Modified: python/trunk/Doc/library/sqlite3.rst
> ==============================================================================
> --- python/trunk/Doc/library/sqlite3.rst (original)
> +++ python/trunk/Doc/library/sqlite3.rst Fri Mar 28 09:32:09 2008
> @@ -378,6 +378,27 @@
> deleted since the database connection was opened.
>>> +.. attribute:: Connection.iterdump
Shouldn't that be a .. method?
> + Returns an iterator to dump the database in an SQL text format. Useful when
> + saving an in-memory database for later restoration. This function provides
> + the same capabilities as the :kbd:`.dump` command in the :program:`sqlite3`
> + shell.
> +
> + .. versionadded:: 2.6
> +
> + Example::
> +
> + # Convert file existing_db.db to SQL dump file dump.sql
> + import sqlite3, os
> +
> + con = sqlite3.connect('existing_db.db')
> + full_dump = os.linesep.join([line for line in con.iterdump()])
> + f = open('dump.sql', 'w')
> + f.writelines(full_dump)
> + f.close()
> +
> +
--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-checkins
mailing list