Skip to main content

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


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)

Uploaded Source

Built Distribution

MercurySQLite-0.0.2-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page