Automated Action 509017284f Fix database migration error for async SQLite connection
- Updated alembic.ini to use the async SQLite driver\n- Updated alembic env.py to support async operations\n- Created storage directory for database files\n- Added .gitignore to exclude temporary files and databases\n\ngenerated with BackendIM... (backend.im)
2025-05-15 15:52:44 +00:00

Generic REST API Service

A RESTful API service built with FastAPI and SQLite for database storage.

Features

  • RESTful API endpoints for CRUD operations on items
  • Async SQLAlchemy with SQLite database
  • Database migrations with Alembic
  • Health check endpoint
  • Pydantic schemas for validation
  • Comprehensive API documentation

Project Structure

├── alembic/             # Database migration files
├── app/                 # Application package
│   ├── api/             # API endpoints and routes
│   ├── db/              # Database connection and utilities
│   ├── models/          # SQLAlchemy ORM models
│   └── schemas/         # Pydantic schemas for validation and serialization
├── main.py              # Application entry point
├── requirements.txt     # Project dependencies
└── README.md            # This file

API Endpoints

  • GET /health: Check API health status
  • GET /api/items: List all items
  • GET /api/items/{item_id}: Get a specific item
  • POST /api/items: Create a new item
  • PUT /api/items/{item_id}: Update an existing item
  • DELETE /api/items/{item_id}: Delete an item

Getting Started

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Run the application:

    uvicorn main:app --reload
    
  3. Access the API documentation:

Database Migrations

Database migrations are managed with Alembic:

# Apply migrations
alembic upgrade head

# Create a new migration
alembic revision --autogenerate -m "description"
Description
Project: Generic REST API Service
Readme 40 KiB
Languages
Python 95.5%
Mako 4.5%