MCPcopy
hub / github.com/piccolo-orm/piccolo

github.com/piccolo-orm/piccolo @1.35.0 sqlite

repository ↗ · DeepWiki ↗ · release 1.35.0 ↗
3,480 symbols 17,994 edges 387 files 1,130 documented · 32%
README

Logo

Tests Release Documentation Status PyPI codecov

Piccolo is a fast, user friendly ORM and query builder which supports asyncio. Read the docs.

Features

Some of it’s stand out features are:

  • Support for sync and async.
  • A builtin playground, which makes learning a breeze.
  • Tab completion support - works great with iPython and VSCode.
  • Batteries included - a User model, authentication, migrations, an admin GUI, and more.
  • Modern Python - fully type annotated.
  • Make your codebase modular and scalable with Piccolo apps (similar to Django apps).

Syntax

The syntax is clean and expressive.

You can use it as a query builder:

# Select:
await Band.select(
    Band.name
).where(
    Band.popularity > 100
)

# Join:
await Band.select(
    Band.name,
    Band.manager.name
)

# Delete:
await Band.delete().where(
    Band.popularity < 1000
)

# Update:
await Band.update({Band.popularity: 10000}).where(
    Band.name == 'Pythonistas'
)

Or like a typical ORM:

# To create a new object:
b = Band(name='C-Sharps', popularity=100)
await b.save()

# To fetch an object from the database, and update it:
b = await Band.objects().get(Band.name == 'Pythonistas')
b.popularity = 10000
await b.save()

# To delete:
await b.remove()

Installation

Installing with PostgreSQL driver:

pip install 'piccolo[postgres]'

Installing with SQLite driver:

pip install 'piccolo[sqlite]'

Installing with all optional dependencies (easiest):

pip install 'piccolo[all]'

Building a web app?

Let Piccolo scaffold you an ASGI web app, using Piccolo as the ORM:

piccolo asgi new

Starlette, FastAPI, BlackSheep, Litestar, Ravyn, Lilya, Quart, Falcon and Sanic are currently supported.

Piccolo ecosystem

Piccolo Admin

Piccolo Admin is a powerful admin interface / content management system for Python, built on top of Piccolo.

It was created at a design agency to serve the needs of customers who demand a high quality, beautiful admin interface for their websites. It's a modern alternative to tools like Wordpress and Django Admin.

It's built using the latest technologies, with Vue.js on the front end, and a powerful REST backend.

Some of it's standout features:

  • Powerful data filtering
  • Builtin security
  • Multi-factor Authentication
  • Media support, both locally and in S3 compatible services
  • Dark mode support
  • CSV exports
  • Easily create custom forms
  • Works on mobile and desktop
  • Use standalone, or integrate with several supported ASGI frameworks
  • Multilingual out of box
  • Bulk actions, like updating and deleting data
  • Flexible UI - only show the columns you want your users to see

You can read the docs here.

Piccolo API

Utilities for easily exposing Piccolo tables as REST endpoints in ASGI apps, such as Starlette and FastAPI.

Includes a bunch of useful ASGI middleware:

  • Session Auth
  • Token Auth
  • Rate Limiting
  • CSRF
  • Content Security Policy (CSP)
  • And more

You can read the docs here.

Are you a Django user?

We have a handy page which shows the equivalent of common Django queries in Piccolo.

Documentation

Our documentation is on Read the docs.

We also have some great tutorial videos on YouTube.

Core symbols most depended-on inside this repo

run_sync
called by 1070
tests/base.py
assertEqual
called by 747
tests/columns/m2m/base.py
select
called by 335
piccolo/table.py
assertTrue
called by 206
tests/columns/m2m/base.py
save
called by 190
piccolo/table.py
where
called by 181
piccolo/query/methods/count.py
objects
called by 141
piccolo/table.py
first
called by 128
piccolo/query/methods/select.py

Shape

Method 2,253
Class 936
Function 215
Route 76

Languages

Python100%

Modules by API surface

piccolo/columns/column_types.py190 symbols
tests/apps/migrations/auto/integration/test_migrations.py106 symbols
tests/table/test_select.py101 symbols
tests/utils/test_pydantic.py98 symbols
piccolo/query/mixins.py91 symbols
piccolo/apps/migrations/auto/serialisation.py76 symbols
piccolo/engine/sqlite.py70 symbols
tests/apps/migrations/auto/test_migration_manager.py65 symbols
piccolo/table.py61 symbols
piccolo/query/methods/alter.py58 symbols
piccolo/columns/base.py58 symbols
piccolo/engine/postgres.py49 symbols

Dependencies from manifests, versioned

Jinja22.11.0 · 1×
colorama0.4.0 · 1×
inflection0.5.1 · 1×
piccolo_admin1.0.0 · 1×
targ0.3.7 · 1×
typing-extensions4.3.0 · 1×

For agents

$ claude mcp add piccolo \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact