mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-14 20:44:11 +02:00
db.iterdump() method uses sqlite-dump if available
This commit is contained in:
parent
5f0517fb11
commit
31bde41baf
8 changed files with 55 additions and 8 deletions
|
|
@ -60,6 +60,12 @@ To install ``sqlean.py`` (which has compiled binary wheels available for all maj
|
|||
|
||||
sqlite-utils install sqlean.py
|
||||
|
||||
``pysqlite3`` and ``sqlean.py`` do not provide implementations of the ``.iterdump()`` method. To use that method (see :ref:`python_api_itedump`) or the ``sqlite-utils dump`` command you should also install the ``sqlite-dump`` package:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sqlite-utils install sqlite-dump
|
||||
|
||||
.. _installation_completion:
|
||||
|
||||
Setting up shell completion
|
||||
|
|
|
|||
|
|
@ -1779,6 +1779,25 @@ The ``db.sqlite_version`` property returns a tuple of integers representing the
|
|||
>>> db.sqlite_version
|
||||
(3, 36, 0)
|
||||
|
||||
.. _python_api_itedump:
|
||||
|
||||
Dumping the database to SQL
|
||||
===========================
|
||||
|
||||
The ``db.iterdump()`` method returns a sequence of SQL strings representing a complete dump of the database. Use it like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
full_sql = "".join(db.iterdump())
|
||||
|
||||
This uses the `sqlite3.Connection.iterdump() <https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.iterdump>`__ method.
|
||||
|
||||
If you are using ``pysqlite3`` or ``sqlean.py`` the underlying method may be missing. If you install the `sqlite-dump <https://pypi.org/project/sqlite-dump/>`__ package then the ``db.iterdump()`` method will use that implementation instead:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install sqlite-dump
|
||||
|
||||
.. _python_api_introspection:
|
||||
|
||||
Introspecting tables and views
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue