Skip to main content

A simple router for data_models

Project description

DataModel-Router

DataModel-Router is a simple router for data models built with FastAPI and SQLModel. It provides a set of utilities and routes to manage data models efficiently.

Features

  • Dynamic route generation for CRUD operations
  • Query parameter validation
  • Easy integration with FastAPI

Installation

To install the dependencies, run:

pip install -r 

Usage

Define Your Data Model

Create a data model using DataModel-ORM:

from datamodel_orm import DataMode, Field
from typing import Optional

class TestDataModel(DataModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    name: str
    age: int

Create and Include the Router

Create a router for your data model and include it in your FastAPI app:

from fastapi import FastAPI
from data_model_router import DataModelRouter

app = FastAPI()
app.include_router(DataModelRouter(TestDataModel))

Run the Application

Run your FastAPI application:

uvicorn main:app --reload

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

datamodel_router-2.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

datamodel_router-2.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file datamodel_router-2.1.0.tar.gz.

File metadata

  • Download URL: datamodel_router-2.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for datamodel_router-2.1.0.tar.gz
Algorithm Hash digest
SHA256 6b824aa1bfcb962c0d85c59cc7f2f52d4ccc42a8bec02cfa0894d1a58af88086
MD5 0ecde21997eafe722b7d9b9fc4d673dd
BLAKE2b-256 2a657f2ca9f5106e7698596ece1e84cd3f54a194ea0b2632a3210b040c8c36b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamodel_router-2.1.0.tar.gz:

Publisher: python-publish.yml on TobiasAhlers/DataModel-Router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datamodel_router-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for datamodel_router-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e167c0d08f3b0e2ea1a19a90d145457e98212cfdd78a3947ad88d0a6ba53507e
MD5 54e75e3302500940b773b48b0e78765c
BLAKE2b-256 752470ccea8ffe8bd7e968a181afbb3196e901564d917de403b9b7a552a0d936

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamodel_router-2.1.0-py3-none-any.whl:

Publisher: python-publish.yml on TobiasAhlers/DataModel-Router

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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