Skip to main content

Simple sqlite3-based ORM

Project description

wurm

Wurm is a simple sqlite3-based ORM.

Usage

# create a table:

@dataclass
class Point(wurm.Table):
    x: int
    y: int

# types currently supported: int, str, bytes, bool, float

# sqlite3 connections cannot be shared, so call setup_connection once per thread

wurm.setup_connection(sqlite3.connect(":memory:"))

# adding new instances to the database:

point = Point(1, 0)
print(point.rowid) # None
point.insert()
print(point.rowid) # 1

# making changes:

point.x = 2
point.commit()

# simple queries:

point = Point[1] # get by rowid
del Point[1] # delete by rowid
point.delete() # delete from an object
all_points = list(Point) # iterate over a table to get instances for all rows
number_of_points = len(Point) # get the total number of rows in the table

Installation

wurm is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 3.7+.

$ pip install wurm

Changelog

0.0.2

  • Ensure tables are created, even in edge cases.

  • Add support for date, time, datetime and Path.

  • Add wurm.Unique[T].

License

wurm is distributed under the terms of the MIT License.

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

wurm-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

wurm-0.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wurm-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for wurm-0.0.2.tar.gz
Algorithm Hash digest
SHA256 20a47ac247dbaca4a28b1bff8a54f11b328816f6f9ceb1ffbad8937f31b82907
MD5 6c95ab70e0faf271e3b3ef34fd807d81
BLAKE2b-256 057e2fd27ee84ba38cbba8d1df4df64bea2bf60a8478d9fdde7d2f3b1199d30b

See more details on using hashes here.

File details

Details for the file wurm-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: wurm-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

File hashes

Hashes for wurm-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2f8785dd6b89d26b00cbc98b65b99d7344c76a16e81e903abf77bddb3437a92a
MD5 f9b8effece048ec56ad52b88db7563b6
BLAKE2b-256 b4d4ad5c48027d8c0681a01a085581262fdc2bcb7530e740b73a274c05691822

See more details on using hashes here.

Supported by

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