{"id":21329,"library":"fastcrud","title":"FastCRUD","description":"FastCRUD is a Python package for FastAPI, offering robust async CRUD operations and flexible endpoint creation utilities. Built on SQLAlchemy, it supports SQLModel and provides automatic relationship detection, pagination, filtering, and more. Current version is 0.21.0, with releases every few months; Python 3.10+ required.","status":"active","version":"0.21.0","language":"python","source_language":"en","source_url":"https://github.com/benavlabs/fastcrud","tags":["fastapi","crud","sqlalchemy","orm","async","pagination","sqlmodel"],"install":[{"cmd":"pip install fastcrud","lang":"bash","label":"Standard install"},{"cmd":"pip install fastcrud[sqlmodel]","lang":"bash","label":"Install with SQLModel support"}],"dependencies":[{"reason":"Core web framework dependency for endpoints","package":"fastapi","optional":false},{"reason":"ORM dependency for async CRUD operations","package":"sqlalchemy","optional":false},{"reason":"Optional SQLModel integration for FastCRUD","package":"sqlmodel","optional":true}],"imports":[{"note":"In older versions, the main class was under fastcrud.crud; now directly from fastcrud.","wrong":"from fastcrud.crud import FastCRUD","symbol":"FastCRUD","correct":"from fastcrud import FastCRUD"},{"note":"The fastcrud.paginated module was removed in v0.20.0. Import from top-level fastcrud instead.","wrong":"from fastcrud.paginated import PaginatedListResponse","symbol":"PaginatedListResponse","correct":"from fastcrud import PaginatedListResponse"},{"note":"No common wrong import; just use from fastcrud.","wrong":"","symbol":"endpoint_creator","correct":"from fastcrud import endpoint_creator"}],"quickstart":{"code":"from fastapi import FastAPI\nfrom pydantic import BaseModel\nfrom sqlalchemy import Column, Integer, String, create_engine\nfrom sqlalchemy.ext.declarative import declarative_base\nfrom sqlalchemy.orm import sessionmaker\nfrom fastcrud import FastCRUD\n\n# Setup SQLAlchemy\nBase = declarative_base()\nclass Item(Base):\n    __tablename__ = 'items'\n    id = Column(Integer, primary_key=True)\n    name = Column(String)\n\nengine = create_engine('sqlite:///./test.db')\nBase.metadata.create_all(bind=engine)\nSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)\n\napp = FastAPI()\ncrud = FastCRUD(Item)\n\n@app.post('/items/')\nasync def create_item(name: str):\n    db = SessionLocal()\n    result = await crud.create(db=db, object={'name': name})\n    db.close()\n    return result","lang":"python","description":"Minimal FastAPI app with SQLAlchemy and FastCRUD to create an item."},"warnings":[{"fix":"To retrieve the created model, either pass a schema_to_select or explicitly call get() after create().","message":"In v0.20.0, the create() method no longer returns the SQLAlchemy model when schema_to_select is not provided. It returns None instead, for consistency with other CRUD methods.","severity":"breaking","affected_versions":">=0.20.0"},{"fix":"Upgrade Python to 3.10 or later.","message":"Python 3.9 support was dropped in v0.21.0. Minimum Python version is now 3.10.","severity":"breaking","affected_versions":">=0.21.0"},{"fix":"Change 'from fastcrud.paginated import PaginatedListResponse' to 'from fastcrud import PaginatedListResponse'.","message":"The fastcrud.paginated module is deprecated and was removed in v0.20.0. Use imports from fastcrud directly.","severity":"deprecated","affected_versions":">=0.19.0, <0.20.0"},{"fix":"Provide schema_to_select parameter to create() or switch to get() after create.","message":"The create() method triggers a deprecation warning if called without schema_to_select in v0.19.x, and returns None in v0.20+. If you rely on the returned model, you must update your code.","severity":"gotcha","affected_versions":">=0.19.2, <0.20.0"},{"fix":"Set include_relationships=True in your routes to leverage automatic detection, or keep manual configuration.","message":"Automatic relationship detection (include_relationships=True) is new in v0.21.0. In earlier versions, you had to manually configure joins. If upgrading, review your code that manually sets up relationships.","severity":"gotcha","affected_versions":"<0.21.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change import to 'from fastcrud import PaginatedListResponse'.","cause":"Importing PaginatedListResponse from fastcrud.paginated which was removed in v0.20.0.","error":"type object 'PaginatedListResponse' has no attribute '__pydantic_model__'"},{"fix":"Either pass schema_to_select to create() or call get() after create(): result = await crud.create(db, object=item_data, schema_to_select=ItemSchema)","cause":"create() without schema_to_select returns None in v0.20.0+; previously it returned the model.","error":"AttributeError: 'NoneType' object has no attribute 'id' (when accessing result.id after create())"},{"fix":"Use 'from fastcrud import FastCRUD' instead of 'from fastcrud.crud import FastCRUD'.","cause":"In older installations, the import path changed; FastCRUD is now directly from fastcrud.","error":"ImportError: cannot import name 'FastCRUD' from 'fastcrud.crud'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}