Use built-in sqlite3 library to operate sql in a more pythonic way.
Project description
PySQLite
Operate SQLite in a more pythonic way.
是个啥
用更Python的方式操作sqlite数据库。
比如说....
创建数据库
SQL
CREATE DATABASE IF NOT EXISTS test;
PySQLite
db = DataBase('test')
创建数据表
SQL
CREATE TABLE IF NOT EXISTS test (
id INTEGER PRIMARY KEY
);
PySQLite
table = db.createTable('test')
table.newColumn('id', 'INTEGER', primaryKey=True)
添加列
SQL
ALTER TABLE test
ADD COLUMN name TEXT;
PySQLite
table.newColumn('name', 'TEXT')
删除列
SQL
ALTER TABLE table
DROP COLUMN name;
PySQLite
del table['name']
添加记录
SQL
INSERT INTO test (id, name) VALUES (1, 'Bernie Huang');
PySQLite
table.insert(id=1, name='Bernie Huang')
查找记录
SQL
SELECT * FROM test WHERE id=1 AND name='Bernie Huang';
PySQLite
rec = table(
(table['id'] == 1) \
& (table['name'] == 'test')
)
依赖项:
sqlite3(Python自带)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
MercurySQLite-0.0.1.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for MercurySQLite-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0444eb3bf8a1ab61815e9bc8eb260b134099df6395fb272319dc6cfec052d59 |
|
MD5 | b0882f1c5d4080f29ae64ea286dfefab |
|
BLAKE2b-256 | 8843635d9a1dccc3d8dd6f26a9c6df533edba26964a01af6e5b670d5cef8f68f |