Skip to main content

A SQL/database library

Project description

master Travis CI Status PyPi package version Documentation Status

quma is a small SQL database library for Python and PyPy version 3.5 and higher. It maps object methods to SQL script files and supports SQLite, PostgreSQL, MySQL and MariaDB.

It also provides a simple connection pool and templating for dynamic SQL like conditional WHEREs.

Motivation

Unlike ORMs, it allows to write SQL as it was intended and to use all features the DBMS provides. As it uses plain SQL files you can fully utilize your database editor or IDE to author your queries.

If you know how to best design your DDL and already have a SELECT in your mind when data needs to be retrieved, welcome, this is for you.

It gives you back your powers you so carelessly gave away to ORMs.

Installation

pip install quma

Quick Start

The full documentation is available at https://quma.readthedocs.io

Given a directory with some SQL scripts e. g.:

/path/to/sql/scripts
├── users
│    ├── all.sql
│    └── remove.sql
└── get_admin.sql

You can access these scripts after connecting to the database:

from quma import Database

db = Database('sqlite:///:memory:', '/path/to/sql/scripts')

db.execute('CREATE TABLE users ...')

with db.cursor as cur:
    all_users = cur.users.all()

    for user in all_users:
        print(user['name'])

    cur.users.remove(id=user['id']).run()
    cur.commit()

    admin = cur.get_admin().one()

License

quma is released under the MIT license.

Copyright © 2018-2020 ebene fünf GmbH. All rights reserved.

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

quma-0.1.0.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

quma-0.1.0-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file quma-0.1.0.tar.gz.

File metadata

  • Download URL: quma-0.1.0.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for quma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6d8b413658bff074e5a76ba1225e7e779c4e8e50772fbf61529319411a36e448
MD5 05527ce78f0e913e7c568ee43e4a749e
BLAKE2b-256 a6331ae8de41b787e37bd2b15203e2f82483b1fb6e4fbf2614a30f23461aeb02

See more details on using hashes here.

File details

Details for the file quma-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: quma-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for quma-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1020f76471b4af3554d52148c4b0c64c6caf6bab4af9c6f1feb035cfc42bd926
MD5 ca5eed8757a58aaf0d8734a0a2ca07a2
BLAKE2b-256 264d84d43e809c04779a49d8592f0a495c21391922e7779260b826a166dd42e2

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