使用教程
快速开始
import dber
db = dber.SQLite("test.db")
create_table_sql = """
CREATE TABLE IF NOT EXISTS t_test (
data_key varchar(255) PRIMARY KEY,
data_value text,
data_int integer
);
"""
# 创建数据表
db.execute(create_table_sql)
# 插入数据
db.replace("replace into t_test values (?,?,?)", "test_key", "test_data", 1)
# 查询数据
print(db.select("select * from t_test where data_key = ?", "test_key"))
print(db.selectOne("select * from t_test where data_key = ?", "test_key"))
print(db.selectTable("t_test", data_key="test_key"))
# 查询字段
print(db.getColumnIntValue("select data_int from t_test where data_key = ?", "test_key"))
print(db.getColumnFloatValue("select data_int from t_test where data_key = ?", "test_key"))
print(db.getColumnBoolValue("select data_value,data_int from t_test where data_key = ?", "test_key", column="data_int"))
# 批量插入数据
rows = []
for i in range(0, 100):
row = (f"k{i}", f"v{i}", i)
rows.append(row)
db.replaceBatch("replace into t_test values (?,?,?)", rows)
print(db.count("t_test"))
print(db.count("t_test", where="data_int > 90"))
# 更新数据
db.update("update t_test set data_int=? where data_key = ?", 100, 'test_key')
# 删除数据
db.delete("delete from t_test")
# 清空表
db.clear("t_test")
# 删除表
db.drop("t_test")
# 关闭
db.close()
Metadata
Release files for dber 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dber-0.0.5.tar.gz | 9.1 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dber-0.0.5-py3.9.egg | Legacy Egg format | - | - | Details |
| dber-0.0.5-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 33.2 kB
Release files / dber-0.0.5.tar.gz
| Download URL | dber-0.0.5.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6f284e625040ba788edda218adf43d95dd0d788cfb1710c14b2b406d2243f05c
|
|
BLAKE2b-256 checksum How to use checksums |
d5a0d4b4595e097d05e066e9ab52acff3b40ff8187539b123727f322dab0ecf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / dber-0.0.5-py3.9.egg
| Download URL | dber-0.0.5-py3.9.egg |
|---|---|
| Size | 16.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
f6e65efbce977cef1b7849734b9d0599499b374f9540e2aff9a3b4da063ab1ab
|
|
BLAKE2b-256 checksum How to use checksums |
208f6033f8f39a857a7df7385d5a59ebabc97642e7f59def4adb17180e3471a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / dber-0.0.5-py2.py3-none-any.whl
| Download URL | dber-0.0.5-py2.py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
46f8fda7dd515c7c9994b00dfe0abfd10ee403559f058e743b511afb41f83945
|
|
BLAKE2b-256 checksum How to use checksums |
a6d630f61ecb5d0c3479b765ec6598718a34609a4a70e728c66bfb68c4c562fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for dber 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.