Skip to main content

simple dao and ORM for sqlite

Project description

SqliteDao

PyPI version   Python 3.x   PyPI license   Downloads

A simplified DAO for SQL abstraction for personal projects. All in one file.

pip install sqlitedao

Pet project: crawfish

Examples

Create Table easily:

dao = SqliteDao.get_instance(DB_PATH)

create_table_columns = {
    "name": "text",
    "position": "text",
    "age": "integer",
    "height": "text"
}
dao.create_table(TEST_TABLE_NAME, create_table_columns)

Or with a bit more control:

columns = ColumnDict()
columns\
    .add_column("name", "text", "PRIMARY KEY")\
    .add_column("position", "text")\
    .add_column("age", "integer")\
    .add_column("height", "text")
create_table_indexes = {
    "name_index": ["name"]
}
dao.create_table(TEST_TABLE_NAME, columns, create_table_indexes)

Create ORM classes by inheriting TableItem easily and deal with even less code,

dao.insert_item(item)
dao.insert_items(items)
dao.update_item(changed_item)
dao.update_items(changed_items)
dao.find_item(item_with_only_index_populated)
...

see test files for example. This can greatly simplify and ease the creation cost for pet projects based on sqlite.

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

sqlitedao-0.5.1.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

sqlitedao-0.5.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlitedao-0.5.1.tar.gz.

File metadata

  • Download URL: sqlitedao-0.5.1.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.13

File hashes

Hashes for sqlitedao-0.5.1.tar.gz
Algorithm Hash digest
SHA256 a67fc1371844be275c9b24c86b23d0ba85fa53be0028908fc228720b453656c0
MD5 2716db3417d41ffdcad9edc6a62c1962
BLAKE2b-256 6277487b91a68de2f3b2ffdd3d58e84d5ecc04762814cbcc4c724f37e38b0241

See more details on using hashes here.

File details

Details for the file sqlitedao-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: sqlitedao-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.13

File hashes

Hashes for sqlitedao-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fc97636bb27c46442c975a17c135d8888d9b1d2e4ae4b78d927c60df0567f544
MD5 0ecba766b37c1454511f60639d328e04
BLAKE2b-256 6fa579f9e70e36be7b0f3143d20a7d8c303481e06d10c07f3edf4564f3af06a5

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