sqlamp是sqlalchemy的物化路径的实现。
sqlamp的Python项目详细描述
sqlamp是一种高效算法的实现 具有分层数据结构–物化路径。sqlamp 使用(并依赖于)SQLAlchemy。
物化路径是一种在关系中存储(和获取)树的方法 数据库。它是嵌套集与相邻集之间的折衷 关于简单性和效率的关系。方法得到推广 在他的书中。瓦迪姆 方法的描述可以在他的文章Trees in SQL: Nested Sets and Materialized Path (by Vadim Tropashko)中阅读。
实现的功能:
- Setting up with ^{tt1}$ 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.
已知工作支持的dbms包括sqlite(使用3.6.14进行测试)。 MySQL(使用服务器版本5.1.34的myisam和innodb进行测试) 和PostgreSQL(使用8.3.7测试),但是sqlamp应该使用任何 sqlalchemy支持的其他dbms。
支持的sqlalchemy版本包括当前的次要版本 分支0.5和0.6以及0.7.2之后的0.7。