Does SQLAlchemy support "close tables"?

I read about closing tables as a way to model hierarchies over SQL.

Does [SQLAlchemy] have built-in support for creating and moving hierarchical collections of object instances (structured collection tree) using close tables?

+6
source share
1 answer

I recently wrote about this.

For the most part, sqlalchemy does nothing that SQL also does; sqlalchemy really only provides ways to generate sql and turn result sets into beautiful python objects.

If your database provides some useful tools for working with recursive relationships, such as the CONNECT BY or WITH RECURSIVE constructors, then sqlalchemy can be easily adapted to handle received queries as selectable and displayed python objects.

In a related post, I came across a partial MySQL read and write implementation that does not offer SQL level support for recursive data structures. The solution I developed created an analogue of the sqlalchemy style attribute, which supported a transitive closure invariant behind the scenes.

+7
source

Source: https://habr.com/ru/post/896826/


All Articles