SQLAlchemy Mixins to store functions for later execution
Project description
SQLAlchemy-Function
SQLAlchemy-Function defines a SQLALchemy Mixin for creating Function
models.
A Function
model has a parent (optional), a function, arguments, and keyword arguments. When called, the Function
model executes its function, passing in its parent (if applicable), its arguments, and its keyword arguments.
Example
Suppose we have a function, foo
, which we want to store. We also want to store the arguments and keyword arguments with which we will later execute foo
.
After setup, we can achieve this with the following:
def foo(*args, **kwargs):
print('My arguments are:', args)
print('My keyword arguments are:', kwargs)
return 'hello world'
f = Function(func=foo, args=['hello moon'], kwargs={'hello': 'star'})
session.add(f)
session.commit()
print(f())
Output:
My arguments are: ('hello moon',)
My keyword arguments are: {'hello': 'star'}
hello world
Documentation
You can find the latest documentation at https://dsbowen.github.io/sqlalchemy-function.
License
Publications which use this software should include the following citation for SQLAlchemy-Function and its dependency, SQLAlchemy-Mutable:
Bowen, D.S. (2019). SQLAlchemy-Function [Computer software]. https://github.com/dsbowen/sqlalchemy-functionv
Bowen, D.S. (2019). SQLAlchemy-Mutable [Computer software]. https://github.com/dsbowen/sqlalchemy-mutable
This project is licensed under the MIT License LICENSE.
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
Built Distribution
Hashes for sqlalchemy-function-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05cab016727770434318c704a3653ae771bc665de810ecade5108176b39316d0 |
|
MD5 | 501f1f6b9f371756dc218483d63c8f48 |
|
BLAKE2b-256 | fd5d13a552369206822d7b118538f8ec38c63bd932032fe787da63f53d8f6285 |
Hashes for sqlalchemy_function-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8cd554b1183edd0cc8c8a530b80bad4ee0152216f6064fd2055a6c3a68220dd |
|
MD5 | dc0dfdccbaabf64ec173ed858d874d95 |
|
BLAKE2b-256 | ec9feab19ecc9e3b1c614767b8d13e1301325c5d6ba2fccc5e3957e597d004bc |