Skip to main content

SQLAlchemy dialect for Mimer SQL (via MimerPy/PEP 249)

Project description

sqlalchemy-mimer

A SQLAlchemy 2.x dialect for Mimer SQL, built on top of the PEP 249-compliant driver MimerPy.

Status: Beta — functional but under active development.

🔧 Installation

From source (editable mode)

python -m pip install -e .

Install (PyPi)

python -m pip install sqlalchemy-mimer

🔗 Connection

Supported URL forms

The dialect supports several URI variants:

  • mimer://user:password@database
  • mimer://user:password@host:port/database
  • mimer://user:password@host:port/?dsn=database
  • mimer+mimerpy://user:password@database
  • mimer+mimerpy://user:password@host:port/database
  • mimer+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.

▶️ Examples

Run basic demo programs:

python examples/demo_test.py -u <database username> -d <database>
python examples/demo_create_table.py

Run a bit more complete demo that show some of the ORM capabilities:

python examples/demo_orm.py -u <database username> -d <database>

🧪 Running Tests

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_PWD

To run all unittests:

python -m unittest discover tests

Run a specific test file for detailed output:

python tests/test_basic_dml.py
python tests/test_constraints.py
python tests/test_orm.py
.
.
.

Documentation

To build the documentation you have to install mkdocs:

python -m pip install mkdocs mkdocs-material

Build documentation:

mkdocs build

View the generated documentation, run:

mkdocs serve

Alternatively 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

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

sqlalchemy_mimer-1.0.3.tar.gz (54.3 kB view details)

Uploaded Source

Built Distribution

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

sqlalchemy_mimer-1.0.3-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_mimer-1.0.3.tar.gz.

File metadata

  • Download URL: sqlalchemy_mimer-1.0.3.tar.gz
  • Upload date:
  • Size: 54.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sqlalchemy_mimer-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1feb3172284151286e79a698bf6f55bdba23d98c760f51e6813721de0d7046c3
MD5 28239b276c7bdb5555cd8c9739fe9957
BLAKE2b-256 edecff63c0f9454b5934dbc4c1cd9f673035b7498d1bfe2de706d376b74e97ae

See more details on using hashes here.

File details

Details for the file sqlalchemy_mimer-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_mimer-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bb0501d8720a1dd182f49b9cd52f2ce5fa756483dd17f4c9841c07608fe3da16
MD5 02700af99f36a2ff21a88c16fec480ca
BLAKE2b-256 818b3c1be776b878dde9eb2a5c01dbb82f738629e7625d6f3a99f202ead0cf4d

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