Metadata-Version: 2.3
Name: dpm2
Version: 2026.3.9.1
Summary: SQLite db and generated Python models for EBA DPM 2.0 databases with full type safety
Author: Jim Lundin
Author-email: Jim Lundin <jimeriklundin@gmail.com>
License: MIT License
         
         Copyright (c) 2025 Jim Lundin
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: sqlalchemy>=2.0.37
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# DPM2

Generated Python models for EBA DPM 2.0 databases with full type safety and SQLAlchemy integration.

## Purpose

This package contains auto-generated, type-safe Python models for working with EBA DPM 2.0 databases. It provides:
- Fully typed SQLAlchemy ORM models
- Relationship mapping between tables
- Bundled SQLite database ready to query
- IDE support with autocompletion and type checking

## Installation

```bash
pip install dpm2
```

## Usage

```python
from sqlalchemy import select
from dpm2 import get_db, models

# Get an in-memory engine backed by the bundled database (default)
engine = get_db()

# Type-safe queries with full IDE support
with engine.connect() as conn:
    stmt = select(models.ConceptClass)

    for row in conn.execute(stmt):
        print(row)
```

### Engine options

```python
from dpm2 import get_db, disk_engine

# In-memory copy (default) - fast, safe for temporary work
engine = get_db()

# Read-only file-backed engine - lower memory usage
engine = get_db(in_memory=False)

# Custom path with disk_engine
from pathlib import Path
engine = disk_engine(Path("my_local_copy.sqlite"))
```

## Features

- **Complete Type Safety** - All columns, relationships, and constraints are fully typed
- **IDE Integration** - Full autocompletion and error detection
- **SQLAlchemy 2.0+** - Uses modern SQLAlchemy with `Mapped` annotations
- **Relationship Navigation** - Foreign keys mapped to navigable Python objects
- **Bundled Database** - Ships with a ready-to-query SQLite database

## Generated Models

This package is automatically generated from the latest EBA DPM release and includes models for all DPM tables with proper relationships and constraints.

## Regeneration

Models are regenerated with each new EBA DPM release. Install the latest version to get updated schemas and data structures.