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.2.tar.gz
(6.3 kB
view hashes)
Built Distribution
Close
Hashes for MercurySQLite-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10b7b2dff79963235bb2336ced0012295cb439797513a34bf2e31534ff42da0d |
|
MD5 | 20579353e4b0a7f426657612687b1eab |
|
BLAKE2b-256 | a8a2edc5e1494caca97bb1f81c226a487daa39ef61e8b4cde660d5239294b946 |