Skip to main content

Basic sqlalchemy helpers

Project description

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

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

db4me-0.1.0.tar.gz (10.6 kB view hashes)

Uploaded Source

Built Distribution

db4me-0.1.0-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page