Skip to main content

数据库操作工具。

Project description

使用教程

快速开始

import jdbcer

db = jdbcer.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()

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

jdbcer-0.0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

jdbcer-0.0.2-py3.9.egg (2.5 kB view details)

Uploaded Egg

jdbcer-0.0.2-py2.py3-none-any.whl (2.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file jdbcer-0.0.2.tar.gz.

File metadata

  • Download URL: jdbcer-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for jdbcer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7666b484cff6ad5b4fdcff784abb10d5c9565e335b5ca175a9612bd0950cc14c
MD5 cf11bc699923b065ed783f8247280d76
BLAKE2b-256 2620da7e6974949beddd99ce7ccd618dba123da488d808742abfcd58e9838684

See more details on using hashes here.

File details

Details for the file jdbcer-0.0.2-py3.9.egg.

File metadata

  • Download URL: jdbcer-0.0.2-py3.9.egg
  • Upload date:
  • Size: 2.5 kB
  • Tags: Egg
  • Uploaded using 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

File hashes

Hashes for jdbcer-0.0.2-py3.9.egg
Algorithm Hash digest
SHA256 7c74615efdefbd9382bf0318bfdd3ab039fb5769b95a6ce519e8cda5a2a08741
MD5 37d675a04f43a0a340ed8bef7d1933b2
BLAKE2b-256 314ef82a6a5c4e90cd65d1abb27354d863a61f959ca32dc93bda6eb55c90ae6d

See more details on using hashes here.

File details

Details for the file jdbcer-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: jdbcer-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for jdbcer-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 36a69364173dd2706dd947917ca54d1d343db25d846ec7b24331be442c681885
MD5 4293e912fdba947744cf489379d621e0
BLAKE2b-256 971b4ce24b4bd0b2fe04d7d9449ad8d79d7e85c7720dd35d80fecd7b0e195992

See more details on using hashes here.

Supported by

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