A SQLAlchemy 2.x dialect for Mimer SQL, built on top of the PEP 249-compliant driver MimerPy.
python -m pip install -e .python -m pip install sqlalchemy-mimerThe dialect supports several URI variants:
mimer://user:password@databasemimer://user:password@host:port/databasemimer://user:password@host:port/?dsn=databasemimer+mimerpy://user:password@databasemimer+mimerpy://user:password@host:port/databasemimer+mimerpy://user:password@host:port/?dsn=database
Example:
from sqlalchemy import create_engine
engine = create_engine("mimer://SYSADM:SYSPASS@mimerdb")
engine = create_engine("mimer://SYSADM:SYSPASS@localhost:1360/mimerdb")
engine = create_engine("mimer+mimerpy://SYSADM:SYSPASS@localhost:1360/?dsn=mimerdb")Note: Until the Mimer SQL C API and MimerPy support host and port parameters, those parts of the URI are parsed but ignored.
Run basic demo programs:
python examples/demo_test.py -u <database username> -d <database>python examples/demo_create_table.pyRun a bit more complete demo that show some of the ORM capabilities:
python examples/demo_orm.py -u <database username> -d <database>Before running the tests a Mimer SQL database ident with databank and ident privileges is needed. If no suitable ident exists it can be created with:
create ident TST_MASTER as user using 'TST_MASTER_PWD';
grant ident to TST_MASTER;
grant databank to TST_MASTER with grant option;To tell the unittests what ident and password to use, set them as environment variables. On Linux and macOS you can do:
export MIMER_TEST_USER=TST_MASTER
export MIMER_TEST_PASSWORD=TST_MASTER_PWDTo run all unittests:
python -m unittest discover testsRun a specific test file for detailed output:
python tests/test_basic_dml.py
python tests/test_constraints.py
python tests/test_orm.py
.
.
.To build the documentation you have to install mkdocs:
python -m pip install mkdocs mkdocs-materialBuild documentation:
mkdocs buildView the generated documentation, run:
mkdocs serveAlternatively build the docs without flat structure that can be viewed in the browser directly without relying on mkdocs serve:
mkdocs build -f mkdir-nodir.yml