.. _examples_toplevel:

============
ORM Examples
============

The SQLAlchemy distribution includes a variety of code examples illustrating
a select set of patterns, some typical and some not so typical.   All are
runnable and can be found in the ``/examples`` directory of the
distribution.   Descriptions and source code for all can be found here.

Additional SQLAlchemy examples, some user contributed, are available on the
wiki at `<https://www.sqlalchemy.org/trac/wiki/UsageRecipes>`_.


Mapping Recipes
===============

.. _examples_adjacencylist:

Adjacency List
--------------

.. automodule:: examples.adjacency_list

.. _examples_associations:

Associations
------------

.. automodule:: examples.association

.. _examples_asyncio:

Asyncio Integration
-------------------

.. automodule:: examples.asyncio

Directed Graphs
---------------

.. automodule:: examples.graphs

Dynamic Relations as Dictionaries
---------------------------------

.. automodule:: examples.dynamic_dict

.. _examples_generic_associations:

Generic Associations
--------------------

.. automodule:: examples.generic_associations


Materialized Paths
------------------

.. automodule:: examples.materialized_paths

Nested Sets
-----------

.. automodule:: examples.nested_sets

.. _examples_performance:

Performance
-----------

.. automodule:: examples.performance


.. _examples_spaceinvaders:

Space Invaders
--------------

.. automodule:: examples.space_invaders


.. _examples_versioning:

Versioning Objects
------------------

.. _examples_versioned_history:

Versioning with a History Table
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: examples.versioned_history

.. _examples_versioned_rows:

Versioning using Temporal Rows
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. automodule:: examples.versioned_rows

.. _examples_vertical_tables:

Vertical Attribute Mapping
--------------------------

.. automodule:: examples.vertical


.. _examples_inheritance:

Inheritance Mapping Recipes
===========================

Basic Inheritance Mappings
--------------------------

.. automodule:: examples.inheritance

Special APIs
============

.. _examples_instrumentation:

Attribute Instrumentation
-------------------------

.. automodule:: examples.custom_attributes

.. _examples_sharding:

Horizontal Sharding
-------------------

.. automodule:: examples.sharding

Extending the ORM
=================

.. _examples_session_orm_events:

ORM Query Events
-----------------

.. automodule:: examples.extending_query

.. _examples_caching:

Dogpile Caching
---------------

.. automodule:: examples.dogpile_caching

