Skip to main content

Also read in 中文

Read full documentation at Read the Docs

MercurySQLite

Operate SQLite in a more pythonic way.

What is it

Operate SQLite database in a more Pythonic way.

For example....

Create Database

SQL

CREATE DATABASE IF NOT EXISTS test;

MercurySQLite

db = DataBase('test')

Create Table

SQL

CREATE TABLE IF NOT EXISTS test (
    id INTEGER PRIMARY KEY
);

MercurySQLite

table = db['test']
table.newColumn('id', int, primaryKey=True)

Delete Table

SQL

DROP TABLE IF EXISTS test;

MercurySQLite

del db['test']

Add Column

SQL

ALTER TABLE test
ADD COLUMN name TEXT;

MercurySQLite

table['name'] = str

Add Primary Key Column

SQL

ALTER TABLE test
ADD COLUMN id INTEGER PRIMARY KEY;

MercurySQLite

table['id'] = int, 'Primary Key'  # 'Primary Key' is case-insensitive

Delete Column

SQL

ALTER TABLE table
DROP COLUMN name;

MercurySQLite

del table['name']

Add Record

SQL

INSERT INTO test (id, name) VALUES (1, 'Bernie Huang');

MercurySQLite

table.insert(id=1, name='Bernie Huang')

Query

SQL

SELECT * FROM test WHERE id=1 AND name='Bernie Huang';

MercurySQLite

rec = table.select(
      (table['id'] == 1) & \
      (table['name'] == 'test')
)   # rec = [{'id': 1, 'name': 'Bernie Huang'}]

Delete Record

SQL

DELETE * FROM test WHERE id=1 AND name='Bernie Huang';

MercurySQLite

((table['id'] == 1) & (table['name'] == 'test')).delete()

Dependencies:

  • sqlite3 (comes with Python)

    So ... no dependencies!


Why is it called MercurySQLite

(===== The following is just some fun speculation by ChatGPT, don't mind it =====)

Speed and Agility: Mercury is the messenger god in ancient Roman mythology, and is synonymous with speed and flexibility. By putting "Mercury" in the name of the library, you might want to convey the speed and agility of this library when handling SQLite databases.

Lightweight: Mercury is a relatively light metal, which may indicate that your library is designed to be lightweight, suitable for resource-sensitive environments such as embedded systems or mobile devices.

Fluidity: Mercury is a liquid metal at room temperature, with good fluidity. This may symbolize that your library provides a smooth API, making operations on SQLite databases more flexible and easy.

Accuracy: Under temperature changes, mercury shows a stable volume, which makes it widely used in thermometers. This may indicate that your library is accurate and stable when handling data, with good reliability.

Chemical Stability: Mercury is a chemically stable element and does not easily react with other elements. This may mean that your library is stable and not prone to conflicts when integrated with other Python libraries or frameworks.

Metadata

Release files for MercurySQLite 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for MercurySQLite 0.1.2
File Size Uploaded
MercurySQLite-0.1.2.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for MercurySQLite 0.1.2
File Interpreter ABI Platform
MercurySQLite-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.2 kB

Release files / MercurySQLite-0.1.2.tar.gz

Download URL MercurySQLite-0.1.2.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
520809e3ea20fb014c7e404844bef65b56c1ce89adbf5d90759586c7c6ef7879
BLAKE2b-256 checksum
How to use checksums
bcbc7f8e5ce22288a4e00be14db54fa94d1a67d92c0abe96b03949e26414cd20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / MercurySQLite-0.1.2-py3-none-any.whl

Download URL MercurySQLite-0.1.2-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
858415846f38674ed61bced6b32a949885008efb1702118025c5e576f48890d9
BLAKE2b-256 checksum
How to use checksums
4506b43502de4d7714ff4abe67783cfd6205c51d2526ad426db2907fc3473c8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page