# sqlite-dump
[![PyPI](https://img.shields.io/pypi/v/sqlite-dump.svg)](https://pypi.org/project/sqlite-dump/)
[![Changelog](https://img.shields.io/github/v/release/simonw/sqlite-dump?label=changelog)](https://github.com/simonw/sqlite-dump/releases)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/sqlite-dump/blob/master/LICENSE)
An improved version of `.iterdump()` for Python's `sqlite3`
## Background
Python's `sqlite3` standard library module provides a method for dumping the contents of a database out as lines of SQL that can be used to recreate the database:
```python
import sqlite3
conn = sqlite3.connect("mydb.db")
for line in conn.iterdump():
print(line)
```
This mechanism is convenient but unfortunately does not support every SQLite feature. In particular it doesn't correctly dump databases that use SQLite's full-text search functionality from the [FTS module](https://www.sqlite.org/fts5.html). This library offers an improved alternative to the `.iterdump()` method.
## Installation
Install this plugin using `pip`:
$ pip install sqlite-dump
## Usage
To loop through lines of SQL that can recreate a SQLite database file:
```python
import sqlite3
from sqlite_dump import iterdump
conn = sqlite3.connect(db_path)
for line in iterdump(conn):
print(line)
```
## Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd sqlite-dump
python -mvenv venv
source venv/bin/activate
Or if you are using `pipenv`:
pipenv shell
Now install the dependencies and tests:
pip install -e '.[test]'
To run the tests:
pytest
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:sqlite-dump-0.1.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
sqlite-dump-0.1.1.tar.gz (10个子文件)
sqlite-dump-0.1.1
PKG-INFO 3KB
sqlite_dump.egg-info
PKG-INFO 3KB
requires.txt 28B
SOURCES.txt 216B
top_level.txt 12B
dependency_links.txt 1B
sqlite_dump
__init__.py 3KB
setup.cfg 38B
setup.py 963B
README.md 2KB
共 10 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功