About Site Map Submit Contact Us Log in | Create an account
Create an account Log In
Average Rating
User Rating:
Visitors Rating:
My rating:

Write review
See full specifications

linux default iconSQLAlchemy Publisher's description

SQLAlchemy is the Python SQL toolkit and.....

SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.

It provides a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a simple and Pythonic domain language.

Key Features of SQLAlchemy:

Some of the key features at a glance:

Supported Platforms

SQLAlchemy supports Python 2.4 and above, including Python 3.x. Jython is also supported, using zxjdbc-enabled dialects. SQLAlchemy is also known to work with PyPy and some success using IronPython has been reported.
Mature, High Performing Architecture

Over five years of constant development, profiling, and refactoring has led to a toolkit that is high performing and accurate, well covered in tests, and deployed in thousands of environments. With virtually every major component in its second or third full iteration, SQLAlchemy 0.6 is roughly twice the speed of older 0.4 versions from just a few years ago. It's raw execution speed is competitive with comparable tools, and advanced ORM features like its unit of work, in-memory collections, eager loading of collections via joins or secondary subselects, and other optimizations allow SQLAlchemy's ORM to emit fewer and more efficient queries than in any previous version.
Supported Databases

SQLAlchemy includes dialects for SQLite, Postgresql, MySQL, Oracle, MS-SQL, Firebird, Sybase and others, most of which support multiple DBAPIs; IBM has also released a DB2 dialect. The corresponding DB-API 2.0 implementation (or sometimes one of several available) is required to use each particular database. View Current DBAPI Support
Unit Of Work

The Unit Of Work system, a central part of SQLAlchemy's Object Relational Mapper (ORM), organizes pending create/insert/update/delete operations into queues and flushes them all in one batch. To accomplish this it performs a topological "dependency sort" of all modified items in the queue so as to honor inter-row dependencies, and groups redundant statements together where they can sometimes be batched even further. This produces the maxiumum efficiency and transaction safety, and minimizes chances of deadlocks. Modeled after Fowler's "Unit of Work" pattern as well as Hibernate, Java's leading object-relational mapper.
Function-based query construction

Function-based query construction allows SQL clauses to be built via Python functions and expressions. The full range of what's possible includes boolean expressions, operators, functions, table aliases, selectable subqueries, create/update/insert/delete statements, correlated updates, correlated EXISTS clauses, UNION clauses, inner and outer joins, bind parameters, and free mixing of literal text within expressions. Constructed expressions are compilable specific to any number of vendor database implementations (such as PostGres or Oracle), as determined by the combination of a "dialect" and "compiler" provided by the implementation.
Separate mapping and class design

Database mapping and class design are totally separate. Persisted objects have no subclassing requirement (other than 'object') and are POPO's : plain old Python objects. They retain serializability (pickling) for usage in various caching systems and session objects. SQLAlchemy "decorates" classes with non-intrusive property accessors to automatically log object creates and modifications with the Unit of Work engine, to lazyload related data, as well as to track attribute change histories.
Eager-loading of related objects and collections

Whole graphs of related objects can often be loaded with a single query or query-per-collection that is automatically generated to join the appropriate tables to the user-defined query, known as eager loading. The alternative to eager loading, lazy loading, loads related objects via distinct query executions. Each type of loading produces identical results and are interchangeable, allowing configuration at any level as well as query-time selection of the relationship-loading method to be used.
Composite (multiple-column) primary keys

In SQLAlchemy, primary and foreign keys are represented as sets of columns; truly composite behavior is implemented from the ground up. The ORM has industrial strength support for meaningful (non-surrogate) primary keys, including mutability and compatibility with ON UPDATE CASCADE, as well as explicit support for other common composite PK patterns such as "association" objects (many-to-many relationships with extra meaning attached to each association).
Self-referential Object Mappings

Self-referential mappings are supported by the ORM. Adjacency list structures can be created, saved, and deleted with proper cascading, with no code overhead beyond that of non-self-referential structures. Loading of self-referential structures of any depth can be tuned to load collections recursively via a single statement with a series of joins (i.e. a joinedload), or via multiple statements where each loads the full set of records at a distinct level of depth (i.e. subqueryload). Persistence with tables that have mutually-dependent foreign key pairs (i.e. "many x"/"one particular x") are also supported natively using the "post update" feature.
Inheritance Mapping
Explicit support is available for single-table, concrete-table, and joined table inheritance. Polymorphic loading (that is, a query that returns objects of multple descendant types) is supported for all three styles. The loading of each may be optimized such that only one round trip is used to fully load a polymorphic result set.
Raw SQL statement mapping

SQLA's object relational query facilities can accomodate raw SQL statements as well as plain result sets, and object instances can be generated from these results in the same manner as any other ORM operation. Any hyper-optimized query that you or your DBA can cook up, you can run in SQLAlchemy, and as long as it returns the expected columns within a rowset, you can get your objects from it. Statements which represent multiple kinds of objects can be used as well, with results received as named-tuples, or with dependent objects routed into collections on parent objects.
Pre- and post-processing of data

The type system allows pre- and post- processing of data, both at the bind parameter and the result set level. User-defined types can be freely mixed with built-in types. Generic types as well as SQL-specific types are available.

What's New in This Release:

В· new features
В· general
В· Documentation has been converted to Sphinx. In particular, the generated API documentation has been constructed into a full blown "API Reference" section which organizes editorial documentation combined with generated docstrings. Cross linking between sections and API docs are vastly improved, a javascript-powered search feature is provided, and a full index of all classes, functions and members is provided.
В· setup.py now imports setuptools only optionally. If not present, distutils is used. The new "pip" installer is recommended over easy_install as it installs in a more simplified way.
В· added an extremely basic illustration of a PostGIS integration to the examples folder.
В· orm
В· Query.with_polymorphic() now accepts a third argument "discriminator" which will replace the value of mapper.polymorphic_on for that query. Mappers themselves no longer require polymorphic_on to be set, even if the mapper has a polymorphic_identity. When not set, the mapper will load non-polymorphically by default. Together, these two features allow a non-polymorphic concrete inheritance setup to use polymorphic loading on a per-query basis, since concrete setups are prone to many issues when used polymorphically in all cases.
В· dynamic_loader accepts a query_class= to customize the Query classes used for both the dynamic collection and the queries built from it.
В· query.order_by() accepts None which will remove any pending order_by state from the query, as well as cancel out any mapper/relation configured ordering. This is primarily useful for overriding the ordering specified on a dynamic_loader(). [ticket:1079]
В· sql
В· RowProxy objects can be used in place of dictionary arguments sent to connection.execute() and friends. [ticket:935]
В· dialect
В· Added a new description_encoding attribute on the dialect that is used for encoding the column name when processing the metadata. This usually defaults to utf-8.
В· mssql
В· Added in a new MSGenericBinary type. This maps to the Binary type so it can implement the specialized behavior of treating length specified types as fixed-width Binary types and non-length types as an unbound variable length Binary type.
В· Added in new types: MSVarBinary and MSImage. [ticket:1249]
В· Added in the MSReal, MSNText, MSSmallDateTime, MSTime, MSDateTimeOffset, and MSDateTime2 types
В· sqlite
В· Table reflection now stores the actual DefaultClause value for the column. [ticket:1266]
В· bugfixes, behavioral changes
В· general
В· orm
В· Exceptions raised during compile_mappers() are now preserved to provide "sticky behavior"
В· if a hasattr() call on a pre-compiled mapped attribute triggers a failing compile and suppresses the exception, subsequent compilation is blocked and the exception will be reiterated on the next compile() call. This issue occurs frequently when using declarative.
В· property.of_type() is now recognized on a single-table inheriting target, when used in the context of prop.of_type(..).any()/has(), as well as query.join(prop.of_type(...)).
В· query.join() raises an error when the target of the join doesn't match the property-based attribute
В· while it's unlikely anyone is doing this, the SQLAlchemy author was guilty of this particular loosey-goosey behavior.
В· Fixed bug when using weak_instance_map=False where modified events would not be intercepted for a flush(). [ticket:1272]
В· Fixed some deep "column correspondence" issues which could impact a Query made against a selectable containing multiple versions of the same table, as well as unions and similar which contained the same table columns in different column positions at different levels. [ticket:1268]
В· Custom comparator classes used in conjunction with column_property(), relation() etc. can define new comparison methods on the Comparator, which will become available via __getattr__() on the InstrumentedAttribute. In the case of synonym() or comparable_property(), attributes are resolved first on the user-defined descriptor, then on the user-defined comparator.
В· Added ScopedSession.is_active accessor. [ticket:976]
В· Can pass mapped attributes and column objects as keys to query.update({}). [ticket:1262]
В· Mapped attributes passed to the values() of an expression level insert() or update() will use the keys of the mapped columns, not that of the mapped attribute.
В· Corrected problem with Query.delete() and Query.update() not working properly with bind parameters. [ticket:1242]
В· Query.select_from(), from_statement() ensure that the given argument is a FromClause, or Text/Select/Union, respectively.
В· Query() can be passed a "composite" attribute as a column expression and it will be expanded. Somewhat related to [ticket:1253].
В· Query() is a little more robust when passed various column expressions such as strings, clauselists, text() constructs (which may mean it just raises an error more nicely).
В· first() works as expected with Query.from_statement().
В· Fixed bug introduced in 0.5rc4 involving eager loading not functioning for properties which were added to a mapper post-compile using add_property() or equivalent.
В· Fixed bug where many-to-many relation() with viewonly=True would not correctly reference the link between secondary->remote.
В· Duplicate items in a list-based collection will be maintained when issuing INSERTs to a "secondary" table in a many-to-many relation. Assuming the m2m table has a unique or primary key constraint on it, this will raise the expected constraint violation instead of silently dropping the duplicate entries. Note that the old behavior remains for a one-to-many relation since collection entries in that case don't result in INSERT statements and SQLA doesn't manually police collections. [ticket:1232]
В· Query.add_column() can accept FromClause objects in the same manner as session.query() can.
В· Comparison of many-to-one relation to NULL is properly converted to IS NOT NULL based on not_().
В· Extra checks added to ensure explicit primaryjoin/secondaryjoin are ClauseElement instances, to prevent more confusing errors later on. [ticket:1087]
В· Improved mapper() check for non-class classes. [ticket:1236]
В· comparator_factory argument is now documented and supported by all MapperProperty types, including column_property(), relation(), backref(), and synonym() [ticket:5051].
В· Changed the name of PropertyLoader to RelationProperty, to be consistent with all the other names. PropertyLoader is still present as a synonym.
В· fixed "double iter()" call causing bus errors in shard API, removed errant result.close() left over from the 0.4 version. [ticket:1099] [ticket:1228]
В· made Session.merge cascades not trigger autoflush. Fixes merged instances getting prematurely inserted with missing values.
Two fixes to help prevent out-of-band columns from being rendered in polymorphic_union inheritance scenarios (which then causes extra tables to be rendered in the FROM clause causing cartesian products):
В· improvements to "column adaption" for a->b->c inheritance situations to better locate columns that are related to one another via multiple levels of indirection, rather than rendering the non-adapted column.
В· the "polymorphic discriminator" column is only rendered for the actual mapper being queried against. The column won't be "pulled in" from a subclass or superclass mapper since it's not needed.
В· Fixed shard_id argument on ShardedSession.execute(). [ticket:1072]
В· sql
В· Columns can again contain percent signs within their names. [ticket:1256]
В· sqlalchemy.sql.expression.Function is now a public class. It can be subclassed to provide user-defined SQL functions in an imperative style, including with pre-established behaviors. The postgis.py example illustrates one usage of this.
В· PickleType now favors == comparison by default, if the incoming object (such as a dict) implements __eq__(). If the object does not implement __eq__() and mutable=True, a deprecation warning is raised.
В· Fixed the import weirdness in sqlalchemy.sql to not export __names__ [ticket:1215].
В· Using the same ForeignKey object repeatedly raises an error instead of silently failing later. [ticket:1238]
В· Added NotImplementedError for params() method on Insert/Update/Delete constructs. These items currently don't support this functionality, which also would be a little misleading compared to values().
В· Reflected foreign keys will properly locate their referenced column, even if the column was given a "key" attribute different from the reflected name. This is achieved via a new flag on ForeignKey/ForeignKeyConstraint called "link_to_name", if True means the given name is the referred-to column's name, not its assigned key. [ticket:650]
В· select() can accept a ClauseList as a column in the same way as a Table or other selectable and the interior expressions will be used as column elements. [ticket:1253]
В· the "passive" flag on session.is_modified() is correctly propagated to the attribute manager.
В· union() and union_all() will not whack any order_by() that has been applied to the select()s inside. If you union() a select() with order_by() (presumably to support LIMIT/OFFSET), you should also call self_group() on it to apply parenthesis.
В· engine/pool
В· Connection.invalidate() checks for closed status to avoid attribute errors. [ticket:1246]
В· NullPool supports reconnect on failure behavior. [ticket:1094]
В· Added a mutex for the initial pool creation when using pool.manage(dbapi). This prevents a minor case of "dogpile" behavior which would otherwise occur upon a heavy load startup. [ticket:799]
В· _execute_clauseelement() goes back to being a private method. Subclassing Connection is not needed now that ConnectionProxy is available.
В· documentation
В· Tickets [ticket:1200] [ticket:1149].
В· Added note about create_session() defaults.
В· Added section about metadata.reflect().
В· Updated `TypeDecorator` section.
В· Rewrote the "threadlocal" strategy section of the docs due to recent confusion over this feature.
В· Removed badly out of date 'polymorphic_fetch' and 'select_table' docs from inheritance, reworked the second half of "joined table inheritance".
В· Documented `comparator_factory` kwarg, added new doc section "Custom Comparators".
В· mssql
В· Refactored the Date/Time types. The ``smalldatetime`` data type no longer truncates to a date only, and will now be mapped to the MSSmallDateTime type. [ticket:1254]
В· Corrected an issue with Numerics to accept an int.
В· Mapped ``char_length`` to the ``LEN()`` function.
В· If an ``INSERT`` includes a subselect the ``INSERT`` is converted from an ``INSERT INTO VALUES`` construct to a ``INSERT INTO SELECT`` construct.
В· If the column is part of a ``primary_key`` it will be ``NOT NULL`` since MSSQL doesn't allow ``NULL`` in primary_key columns.
В· ``MSBinary`` now returns a ``BINARY`` instead of an ``IMAGE``. This is a backwards incompatible change in that ``BINARY`` is a fixed length data type whereas ``IMAGE`` is a variable length data type. [ticket:1249]
В· ``get_default_schema_name`` is now reflected from the database based on the user's default schema. This only works with MSSQL 2005 and later. [ticket:1258]
В· Added collation support through the use of a new collation argument. This is supported on the following types: char, nchar, varchar, nvarchar, text, ntext. [ticket:1248]
В· Changes to the connection string parameters favor DSN as the default specification for pyodbc. See the mssql.py docstring for detailed usage instructions.
В· Added experimental support of savepoints. It currently does not work fully with sessions.
В· Support for three levels of column nullability: NULL, NOT NULL, and the database's configured default. The default Column configuration (nullable=True) will now generate NULL in the DDL. Previously no specification was emitted and the database default would take effect (usually NULL, but not always). To explicitly request the database default, configure columns with nullable=None and no specification will be emitted in DDL. This is backwards incompatible behavior. [ticket:1243]
В· postgres
В· "%" signs in text() constructs are automatically escaped to "%%". Because of the backwards incompatible nature of this change, a warning is emitted if '%%' is detected in the string. [ticket:1267]
В· Calling alias.execute() in conjunction with server_side_cursors won't raise AttributeError.
В· Added Index reflection support to Postgres, using a great patch we long neglected, submitted by Ken Kuhlman. [ticket:714]
В· oracle
В· Adjusted the format of create_xid() to repair two-phase commit. We now have field reports of Oracle two-phase commit working properly with this change.
В· Added OracleNVarchar type, produces NVARCHAR2, and also subclasses Unicode so that convert_unicode=True by default. NVARCHAR2 reflects into this type automatically so these columns pass unicode on a reflected table with no explicit convert_unicode=True flags. [ticket:1233]
В· Fixed bug which was preventing out params of certain types from being received; thanks a ton to huddlej at wwu.edu ! [ticket:1265]
В· mysql
В· "%" signs in text() constructs are automatically escaped to "%%". Because of the backwards incompatible nature of this change, a warning is emitted if '%%' is detected in the string.
В· Fixed bug in exception raise when FK columns not present during reflection. [ticket:1241]
В· Fixed bug involving reflection of a remote-schema table with a foreign key ref to another table in that schema.
В· associationproxy
В· The association proxy properties are make themselves available at the class level, e.g. MyClass.aproxy. Previously this evaluated to None.
В· declarative
В· The full list of arguments accepted as string by backref() includes 'primaryjoin', 'secondaryjoin', 'secondary', 'foreign_keys', 'remote_side', 'order_by'.

System Requirements:

В· Python
Program Release Status: Minor Update
Program Install Support: Install and Uninstall

Is SQLAlchemy your software?

Manage your software

Most Popular

linux default icon A2Billing 1.6.0
A2Billing is a billing system interactive with Asterisk to give any Telecom company traditional offering VOIP... Read more
linux default icon FrontAccounting 2.3.10
FrontAccounting is free and released under the GNU General Public License.
linux default icon PgAdmin III for Linux 1.14.1
pgAdmin is the most popular and feature rich Open Source administration and development platform for... Read more
linux default icon RazorSQL for Linux 5.6.3
RazorSQL is an SQL query tool, database browser, SQL editor,....
linux default icon Salat Book 1.00
Salat / Namaz prayer database and tracking application