SQLAlchemy is a Python SQL toolkit and a database object mapping framework. It includes a complete enterprise-class persistence model, specifically for efficient and high-performance database access.
SQL databases behave less like object collections the more size and performance start to matter; object collections behave less like tables and rows the more abstraction starts to matter. SQLAlchemy aims to accommodate both of these principles.
SQLAlchemy considers the database to be a relational algebra engine, not just a collection of tables. Rows can be selected from not only tables but also joins and other select statements; any of these units can be composed into a larger structure. SQLAlchemy’s expression language builds on this concept from its core.
SQLAlchemy is most famous for its object-relational mapper (ORM), an optional component that provides the data mapper pattern, where classes can be mapped to the database in open ended, multiple ways – allowing the object model and database schema to develop in a cleanly decoupled way from the beginning.
SQLAlchemy’s overall approach to these problems is entirely different from that of most other SQL / ORM tools, rooted in a so-called complimentarity- oriented approach; instead of hiding away SQL and object relational details behind a wall of automation, all processes are fully exposed within a series of composable, transparent tools. The library takes on the job of automating redundant tasks while the developer remains in control of how the database is organized and how SQL is constructed.
The main goal of SQLAlchemy is to change the way you think about databases and SQL!
SQLAlchemy 1.3.4 has been released, this release contains various fixes.
Fixed issue where the
AttributeEvents.active_historyflag would not be set for an event listener that propgated to a subclass via the
AttributeEvents.propagateflag. This bug has been present for the full span of the
Fixed regression where new association proxy system was still not proxying hybrid attributes when they made use of the
@hybrid_property.expressiondecorator to return an alternate SQL expression, or when the hybrid returned an arbitrary
PropComparator, at the expression level. This involved futher generalization of the heuristics used to detect the type of object being proxied at the level of
QueryableAttribute, to better detect if the descriptor ultimately serves mapped classes or column expressions.
Applied the mapper “configure mutex” against the declarative class mapping process, to guard against the race which can occur if mappers are used while dynamic module import schemes are still in the process of configuring mappers for related classes. This does not guard against all possible race conditions, such as if the concurrent import has not yet encountered the dependent classes as of yet, however it guards against as much as possible within the SQLAlchemy declarative process.
A warning is now emitted for the case where a transient object is being merged into the session with
Session.merge()when that object is already transient in the
Session. This warns for the case where the object would normally be double-inserted.
Fixed regression in new relationship m2o comparison logic first introduced at Improvement to the behavior of many-to-one query expressions when comparing to an attribute that is persisted as NULL and is in an un-fetched state in the mapped instance. Since the attribute has no explicit default, it needs to default to NULL when accessed in a persistent setting.