Skip to main content

Python class decorator that creates a database representation of a class and vice versa, a lightweight ORM.

Project description

Database Models

Python class decorator that creates a database representation of a class and vice versa, a lightweight ORM. setup.py provided for installation, uses psycopg 3 rather than 2 for the better context manager support and type hinting.

Recommended Import Setup

import databasemodels as dbm
from databasemodels.datatypes import *

This allows you to use bare datatypes such as INTEGER, or complex datatypes such as PrimaryKey.

Features

All basic types and pseudo-types implemented are all capital, whereas type modifiers and constructed types like enums are capital camel case.

Currently, implemented types/pseudo-types include:

EnumType
INTEGER
SERIAL
REAL
TEXT
TIMESTAMP
TIMESTAMP_WITH_TIMEZONE
DATE
TIME
BOOL
VARCHAR
CHAR
NUMERIC

Currently, implemented constraints include:

ForeignKey
PrimaryKey
Unique
NotNull

Planned Features

  • Interval type
  • Full documentation across all the module
  • Implementation of all types listed here.
  • "Mutation" context managers for database model instances
  • Higher unittest coverage
  • Higher customizability with table creation and other database operations

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

databasemodels-1.3.3.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

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

databasemodels-1.3.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file databasemodels-1.3.3.tar.gz.

File metadata

  • Download URL: databasemodels-1.3.3.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for databasemodels-1.3.3.tar.gz
Algorithm Hash digest
SHA256 73c01ba0a90d091ea55a5fc88f8a88cf40c3f42b19e2aaea04ea9929a9777d30
MD5 300ce28c77c67305a360b274dcce4928
BLAKE2b-256 598638b3159838dca41cdc690a55776e218e57d287ba7340114af271d3506834

See more details on using hashes here.

File details

Details for the file databasemodels-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: databasemodels-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for databasemodels-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4ca04a256cc86eeaf50b68fc94fe2818f2a0c155fc1568ce6727402e9494a3ce
MD5 a09543b26b319976156363af39c18773
BLAKE2b-256 4250f03bfabb6c9fc37d56cc92f613cb00bf672ede2b25da31cc2da3612e1ca2

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