Skip to main content

sqlamp is an implementation of Materialized Path for SQLAlchemy.

Project description

sqlamp is an implementation of an efficient algorithm for working with hierarchical data structures – Materialized Path. sqlamp uses (and depends of) SQLAlchemy.

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 promoted 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:

  • Setting up with declarative.ext or without it.

  • Saving node roots – if no parent set for node.

  • Saving child nodes – if node has some parent. The whole dirty job of setting values in utility fields is done by sqlamp.

  • Fetching node’s descendants, ancestors and children using the most efficient way available.

  • Autochecking exhaustion of tree size limits (maximum number of children and maximum nesting level) is done during session flush.

  • Rebuilding all trees and any subtree on the basis of Adjacency Relations.

  • Collapsing flat tree returned from query to recursive structure.

  • Node classes may use polymorphic inheritance.

  • Nodes and whole trees/subtrees can be moved around or removed entirely.

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.

Supported versions of SQLAlchemy include current minor versions of branches 0.5 and 0.6 as well as 0.7 since 0.7.2.

Project details


Download files

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

Source Distribution

sqlamp-0.6.tar.gz (38.7 kB view details)

Uploaded Source

File details

Details for the file sqlamp-0.6.tar.gz.

File metadata

  • Download URL: sqlamp-0.6.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sqlamp-0.6.tar.gz
Algorithm Hash digest
SHA256 11e85f64e86f8e44f6b4ca13981a35a4b96e8decf79c418b409405b4f139150f
MD5 eab44f7df39193f77ddc70ddd2124020
BLAKE2b-256 9b3bb0aea8ab8a42d0113728b8d7eb21fad32fe1a93714fd302b81eb927de189

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page