Skip to main content

Database configuration and utilities for FastAPI with SQLAlchemy

Project description

rodrigo0000-fastapi-core-database

Database configuration and utilities for FastAPI with SQLAlchemy.

Features

  • SQLAlchemy database setup and configuration
  • Database session management
  • Database initialization utilities
  • Security utilities (JWT, password hashing)
  • Repository pattern base classes

Installation

pip install rodrigo0000-fastapi-core-database

Usage

from rodrigo0000_fastapi_core_database import get_db, Base, engine, init_db
from rodrigo0000_fastapi_core_database import create_access_token, verify_password

# Initialize database
init_db()

# Use in FastAPI dependencies
from fastapi import Depends
from sqlalchemy.orm import Session

@app.get("/items")
def get_items(db: Session = Depends(get_db)):
    # Your code here
    pass

Components

  • Database: SQLAlchemy engine, session, and base configuration
  • Init DB: Database initialization and superuser creation
  • Security: JWT token creation, password hashing, user verification
  • Repository: Base repository pattern for database operations

Requirements

  • Python >= 3.8
  • FastAPI >= 0.104.0
  • SQLAlchemy >= 2.0.0
  • Pydantic >= 2.0.0
  • python-jose[cryptography] >= 3.3.0
  • passlib[bcrypt] >= 1.7.4

License

MIT License

Author

R Firm - Professional SaaS Development

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

rodrigo0000_fastapi_core_database-1.0.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file rodrigo0000_fastapi_core_database-1.0.2.tar.gz.

File metadata

File hashes

Hashes for rodrigo0000_fastapi_core_database-1.0.2.tar.gz
Algorithm Hash digest
SHA256 075f8f7561a4b922eae2d830122b5c50dca54e5e368811eec0aeb3aa224bdb4a
MD5 dd53a981315a2ef65c1061282feb4d80
BLAKE2b-256 3b254ebf8543c01b436b849888a102a0d1f4fc607ddf3c004c9be5020200cb36

See more details on using hashes here.

File details

Details for the file rodrigo0000_fastapi_core_database-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for rodrigo0000_fastapi_core_database-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bdc74febadad27a8751801611d5f871e3717034ea59e8f2802f1a6ef89726eff
MD5 a3319d3d760341bc668d137e4ea9727d
BLAKE2b-256 5be959c82f24f7d3f3e6277d6e48cd29ff49b3caa73f88d6bb4d0eab9201eb3f

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