Skip to main content

Use sqlite just like classes!

Project description

SqliteTable

Use sqlite just like classes!

Create Table

from sqlitetable import SqliteTable
class Student(SqliteTable):
    uid:int
    name:str
Student.create_table('test.db')

The above code creates the following table

CREATE TABLE "student"(
    "uid" INTEGER,
    "name" TEXT
);

Simple Insert

s = Student()
s.uid = 10001
s.name = 'Hu Tao'
s.sqlite_insert()

The above code runs

INSERT INTO "student" ("uid", "name") VALUES (10001, 'Hu Tao');

Simple Select

s = Student()
s.name = 'Hu Tao'
for e in s.sqlite_select():
    print(e, e.uid, e.name)

The above code runs

SELECT "uid" FROM "student" WHERE "name"='Hu Tao';

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

sqlitetable-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: sqlitetable-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for sqlitetable-0.0.2.tar.gz
Algorithm Hash digest
SHA256 995c7a7009eb2acfc88c5bc5fbb51997cbffd0fbdffc3e7ecc729696c4ab179a
MD5 875dde0ef51dd408b4d0d5c366173a77
BLAKE2b-256 e710f04777f1c79c2e873a2f8165a572d8424d2b519d89c60259c4112cc67b70

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