Skip to main content

Declare multi-table rules for SQLAlchemy update logic -- 40X more concise, Python for extensibility.

Project description

This package enables you to declare rules that govern SQLAlchemy update transaction logic (multi-table derivations, constraints, and actions such as sending mail or messages).

Logic is stated in Python, and is over an 40X more concise than code.

Features

Logic is declared in Python (example below), and is:

  • Extensible: logic consists of rules (see below), plus standard Python code

  • Multi-table: rules like sum automate multi-table transactions

  • Scalable: rules are pruned and optimized; for example, sums are processed as 1 row adjustment updates, rather than expensive SQL aggregate queries

  • Manageable: develop and debug your rules in IDEs, manage it in SCS systems (such as git) using existing procedures

Example:

The following 5 rules represent the same logic as 200 lines of Python:

https://github.com/valhuber/LogicBank/raw/main/images/example.png

To activate the rules declared above:

LogicBank.activate(session=session, activator=declare_logic)

Depends on:

  • SQLAlchemy

  • Python 3.8

More information:

The github project includes documentation and examples.

Acknowledgements

Many thanks to

  • Tyler Band, for testing and the Banking sample

  • Max Tardiveau, for testing

  • Nishanth Shyamsundar, for testing

Change Log

0.0.6 - Initial Version

0.0.7 - Class Name can differ from Table Name

0.0.8 - Much-reduced pip-install dependencies

0.0.9 - Hybrid attribute support, old_row example

0.1.0 - Hybrid attribute support, bug fix

0.1.1 - Allocation example - allocate a payment to a set of outstanding orders

0.2.0 - Minor design refactoring of allocation

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logicbank-0.2.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

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

logicbank-0.2.0-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file logicbank-0.2.0.tar.gz.

File metadata

  • Download URL: logicbank-0.2.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for logicbank-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f2b81f1872cea0186b638d2a9761fbbfdf9c6cd05109b1a11e0d57d02392ea5
MD5 1b37687bb8d467ba41747425194eddbd
BLAKE2b-256 07911eeaa8b2feebeeaef5d104e845737db29095beaa9a14834202b1b5b48e1e

See more details on using hashes here.

File details

Details for the file logicbank-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: logicbank-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for logicbank-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1fea8eefc4e60dd93b52a8573374e700b6c1c158baa35d2bf6a23ecb4e552a02
MD5 dad37ebfcb908f3a8ad26ffdd1971f59
BLAKE2b-256 c821fd89339f455307fd1d32b0014298dcede7fa6453812dc8db58fc879acd16

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