Skip to content

OntoSQL

0.5.x beta

API stability tiers are documented in SPECS. Semver guarantees begin at 1.0. Pin versions in production and read Compatibility before upgrading.

0.5.x Python 3.10+ SQLModel + Pydantic JSON-LD · RDF optional

OntoSQL documentation

Semantic data access for SQL-first Python apps

Map ontology-shaped Pydantic models onto real SQL schemas with explicit mappers. Get CRUD, semantic queries, and optional JSON-LD/RDF export from one source of truth — not a SPARQL database.

Pick the path that matches how you work:

  • SQL CRUD


    Semantic models, explicit maps, and OntoSession — no RDF required. Runnable from PyPI in minutes.

    Quick start

  • FastAPI API


    OntoRouter, content negotiation, async lifespan, and production security patterns.

    FastAPI quick start

  • Hybrid SQL + graph


    Mirror SQL writes to RDF on commit; import JSON-LD; materialize graph views.

    Hybrid guide

  • Not sure?


    Start here for a single next step based on your goal.

    Start here

Who is this for?

Teams building SQL-first apps (Postgres, SQLite) that want ontology-shaped Python models and optional JSON-LD/RDF APIs. RDF and graph sync are optional.

Production note: OntoRouter requires dependencies=[Depends(your_auth)] before internet exposure. Graph sync is eventually consistent after SQL commit. See Security.

What you need

Requirement Details
Python 3.10+ — see Compatibility
Install pip install ontosql — extras for async, FastAPI, JSON-LD, SparqlModel, SHACL
Examples Repo clone for examples/ scripts; quick start works from PyPI only
pip install ontosql
pip install "ontosql[async]"     # AsyncOntoSession
pip install "ontosql[fastapi]"   # OntoRouter
pip install "ontosql[jsonld]"    # JSON-LD compact/frame
pip install "ontosql[sparql]"     # SparqlModel graph sync
pip install "ontosql[shacl]"      # SHACL shapes

Release notes: changelog · GitHub CHANGELOG

New to OntoSQL? Follow Start here, the quick start, or the tutorial.

Evaluating adoption? Read When to use OntoSQL, Enterprise adoption, and Security.

Questions? See FAQ or Troubleshooting.