db4me 0.1.0
db4me
Basic sqlalchemy helpers
Installation
python -m pip install db4me
Usage
Include the database settings into your model and, at application
start-up time, create the connection based on these settings.
from pydantic_settings import BaseSettings
from db4me import AllDatabaseSettings, get_engine
class AppSettings(BaseSettings):
# ...
database: AllDatabaseSettings = Field(
description="Database settings.",
)
# ...
settings = AppSettings()
engine = get_engine(settings.database)
Development
Start by creating a virtual environment and installing the dependencies.
If you have a make command available, you can run make init after
the virtual environment is created and activated. Otherwise, you can run
the following commands:
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .[dev]
On Windows, to be able to serve the documentation, you may also need to
install the cairo2 package:
pip install pipwin
pipwin install cairocffi
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.