Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

sqlamp is an implementation of Materialized Path for SQLAlchemy.

Project description

:mod:`sqlamp` --- Materialized Path for SQLAlchemy
==================================================

:mod:`sqlamp` is an implementation of an efficient algorithm for working
with hierarchical data structures --- `Materialized Path`. :mod:`sqlamp`
uses (and depends of) `SQLAlchemy <http://sqlalchemy.org>`_.

`Materialized Path` is a way to store (and fetch) a trees in a relational
databases. It is the compromise between `Nested Sets` and `Adjacency
Relations` in respect to simplicity and efficiency. Method was proposed
by `Vadim Tropashko`_ in his book `SQL Design Patterns`_. Vadim's
description of the method can be read in his article `Trees in SQL:
Nested Sets and Materialized Path (by Vadim Tropashko)`_.

Implemented features:

* Saving node roots --- if no parent set for node. The tree will have
a new `tree_id`.
* Saving child nodes --- if node has some parent. The whole dirty job
of setting values in `tree_id`, `path` and `depth` fields is done
by `sqlamp`.
* Fetching node's descendants, ancestors and children using the most
efficient way available (see :class:`MPInstanceManager`)
* Autochecking exhaustion of tree size limits --- maximum number of
children, maximum nesting level (see :class:`MPManager` to learn
more about limits fine-tuning) is done during session flush.
* Rebuilding all trees (see :meth:`MPClassManager.rebuild_all_trees`)
and any subtree (:meth:`MPClassManager.rebuild_subtree`) on the
basis of Adjacency Relations.

Moving of nodes is not yet implemented.

Known-to-work supported DBMS include `sqlite`_ (tested with 3.6.14),
`MySQL`_ (tested using both MyISAM and InnoDB with server version 5.1.34)
and `PostgreSQL`_ (tested with 8.3.7), but sqlamp should work with any
other DBMS supported by SQLAlchemy.

.. _`Vadim Tropashko`: http://vadimtropashko.wordpress.com
.. _`Sql Design Patterns`:
http://www.rampant-books.com/book_2006_1_sql_coding_styles.htm
.. _`Trees in SQL: Nested Sets and Materialized Path (by Vadim Tropashko)`:
http://www.dbazine.com/oracle/or-articles/tropashko4
.. _`sqlite`: http://sqlite.org
.. _`MySQL`: http://mysql.com
.. _`PostgreSQL`: http://postgresql.org

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sqlamp, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size sqlamp-0.3.tar.gz (20.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page