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.1.tar.gz (2.4 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.1.tar.gz.

File metadata

File hashes

Hashes for rodrigo0000_fastapi_core_database-1.0.1.tar.gz
Algorithm Hash digest
SHA256 56d061d8d4c520a85f3ff53851888187cb39779cb019338af7506a5cf66e4b44
MD5 090f0137b61136d7abe6fa9e490f0c47
BLAKE2b-256 78caca8dbdcd7e2b2b4c025eb8f6b4c2b549c7eb9138b47b14f0ca2065d41939

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rodrigo0000_fastapi_core_database-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c0a37d567ab4079081444c10917d42ff768ecb667bfd81a8ca4053b05e722ca0
MD5 e96b33b7f8f4ee27ac4195e22a280b62
BLAKE2b-256 06eb3c4f67c6e5f40e0634a2d09c009dbbc85d15c1dca5a29fadcf856fb2156e

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