Skip to main content

Build Status Publish Status Coverage Package version Supported Python versions


FastAPI Storages

A collection of backend storages and ORM extensions to simplify file management in FastAPI and Starlette projects.

Similar to django-storages project, but aiming to work with a wider range of database ORMs and backends.


Documentation: https://smithyhq.github.io/fastapi-storages

Source Code: https://github.com/smithyhq/fastapi-storages


Installation

pip install fastapi-storages

Install optional extras based on what you need:

pip install 'fastapi-storages[s3]'
pip install 'fastapi-storages[sqlalchemy]'
pip install 'fastapi-storages[peewee]'
pip install 'fastapi-storages[image]'
pip install 'fastapi-storages[full]'

Supported integrations

  • SQLAlchemy
  • SQLModel
  • SQLAdmin

Supported storage backends

  • FileSystemStorage
  • S3Storage

Example

from fastapi import FastAPI, UploadFile
from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.orm import Session, declarative_base
from fastapi_storages import FileSystemStorage
from fastapi_storages.integrations.sqlalchemy import FileType

app = FastAPI()
Base = declarative_base()
engine = create_engine("sqlite:///test.db")


class Example(Base):
    __tablename__ = "example"

    id = Column(Integer, primary_key=True)
    file = Column(FileType(storage=FileSystemStorage(path="/tmp")))


# Create database and table
Base.metadata.create_all(engine)


@app.post("/upload/")
def create_upload_file(file: UploadFile):
    example = Example(file=file)
    with Session(engine) as session:
        session.add(example)
        session.commit()
        return {"filename": example.file.name}

Metadata

Release files for fastapi-storages 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastapi-storages 0.5.0
File Size Uploaded Provenance
fastapi_storages-0.5.0.tar.gz 7.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fastapi-storages 0.5.0
File Interpreter ABI Platform
fastapi_storages-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / fastapi_storages-0.5.0.tar.gz

Download URL fastapi_storages-0.5.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
558c030daca6992c96ea3811648a1afa165dbdd13635d2b6e196d39556951afc
BLAKE2b-256 checksum
How to use checksums
ce45d5920a64fdcc014b69e8db0a74d419f00d5998fdcbf5b92a8c5ada224649
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fastapi_storages-0.5.0-py3-none-any.whl

Download URL fastapi_storages-0.5.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82c487c04019ea822b259842280e5f1c5d536a193a7090ce3c271078063a919c
BLAKE2b-256 checksum
How to use checksums
89d9c12fc71b82d5bc47e53aab6776eb34798e1fc263ff7b9049c510bbe6d5c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fastapi-storages 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page