mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-05-31 04:48:02 -04:00
5ab558004c
such that the Session, cache manager, declarative_base are part of environment, and custom cache code is portable and now within "caching_query.py". This allows the example to be easier to "drop in" to existing projects.
4248 lines
177 KiB
Plaintext
4248 lines
177 KiB
Plaintext
-*- coding: utf-8; fill-column: 68 -*-
|
|
|
|
=======
|
|
CHANGES
|
|
=======
|
|
0.6.4
|
|
=====
|
|
- sql
|
|
- Changed the scheme used to generate truncated
|
|
"auto" index names when using the "index=True"
|
|
flag on Column. The truncation only takes
|
|
place with the auto-generated name, not one
|
|
that is user-defined (an error would be
|
|
raised instead), and the truncation scheme
|
|
itself is now based on a fragment of an md5
|
|
hash of the identifier name, so that multiple
|
|
indexes on columns with similar names still
|
|
have unique names. [ticket:1855]
|
|
|
|
- examples
|
|
- The beaker_caching example has been reorgnized
|
|
such that the Session, cache manager,
|
|
declarative_base are part of environment, and
|
|
custom cache code is portable and now within
|
|
"caching_query.py". This allows the example to
|
|
be easier to "drop in" to existing projects.
|
|
|
|
0.6.3
|
|
=====
|
|
- orm
|
|
- Removed errant many-to-many load in unitofwork
|
|
which triggered unnecessarily on expired/unloaded
|
|
collections. This load now takes place only if
|
|
passive_updates is False and the parent primary
|
|
key has changed, or if passive_deletes is False
|
|
and a delete of the parent has occurred.
|
|
[ticket:1845]
|
|
|
|
- Column-entities (i.e. query(Foo.id)) copy their
|
|
state more fully when queries are derived from
|
|
themselves + a selectable (i.e. from_self(),
|
|
union(), etc.), so that join() and such have the
|
|
correct state to work from. [ticket:1853]
|
|
|
|
- Fixed bug where Query.join() would fail if
|
|
querying a non-ORM column then joining without
|
|
an on clause when a FROM clause is already
|
|
present, now raises a checked exception the
|
|
same way it does when the clause is not
|
|
present. [ticket:1853]
|
|
|
|
- Improved the check for an "unmapped class",
|
|
including the case where the superclass is mapped
|
|
but the subclass is not. Any attempts to access
|
|
cls._sa_class_manager.mapper now raise
|
|
UnmappedClassError(). [ticket:1142]
|
|
|
|
- Added "column_descriptions" accessor to Query,
|
|
returns a list of dictionaries containing
|
|
naming/typing information about the entities
|
|
the Query will return. Can be helpful for
|
|
building GUIs on top of ORM queries.
|
|
|
|
- mysql
|
|
|
|
- The _extract_error_code() method now works
|
|
correctly with each MySQL dialect (
|
|
MySQL-python, OurSQL, MySQL-Connector-Python,
|
|
PyODBC). Previously,
|
|
the reconnect logic would fail for OperationalError
|
|
conditions, however since MySQLdb and OurSQL
|
|
have their own reconnect feature, there was no
|
|
symptom for these drivers here unless one
|
|
watched the logs. [ticket:1848]
|
|
|
|
- oracle
|
|
- More tweaks to cx_oracle Decimal handling.
|
|
"Ambiguous" numerics with no decimal place
|
|
are coerced to int at the connection handler
|
|
level. The advantage here is that ints
|
|
come back as ints without SQLA type
|
|
objects being involved and without needless
|
|
conversion to Decimal first.
|
|
|
|
Unfortunately, some exotic subquery cases
|
|
can even see different types between
|
|
individual result rows, so the Numeric
|
|
handler, when instructed to return Decimal,
|
|
can't take full advantage of "native decimal"
|
|
mode and must run isinstance() on every value
|
|
to check if its Decimal already. Reopen of
|
|
[ticket:1840]
|
|
|
|
0.6.2
|
|
=====
|
|
- orm
|
|
- Query.join() will check for a call of the
|
|
form query.join(target, clause_expression),
|
|
i.e. missing the tuple, and raise an informative
|
|
error message that this is the wrong calling form.
|
|
|
|
- Fixed bug regarding flushes on self-referential
|
|
bi-directional many-to-many relationships, where
|
|
two objects made to mutually reference each other
|
|
in one flush would fail to insert a row for both
|
|
sides. Regression from 0.5. [ticket:1824]
|
|
|
|
- the post_update feature of relationship() has been
|
|
reworked architecturally to integrate more closely
|
|
with the new 0.6 unit of work. The motivation
|
|
for the change is so that multiple "post update"
|
|
calls, each affecting different foreign key
|
|
columns of the same row, are executed in a single
|
|
UPDATE statement, rather than one UPDATE
|
|
statement per column per row. Multiple row
|
|
updates are also batched into executemany()s as
|
|
possible, while maintaining consistent row ordering.
|
|
|
|
- Query.statement, Query.subquery(), etc. now transfer
|
|
the values of bind parameters, i.e. those specified
|
|
by query.params(), into the resulting SQL expression.
|
|
Previously the values would not be transferred
|
|
and bind parameters would come out as None.
|
|
|
|
- Subquery-eager-loading now works with Query objects
|
|
which include params(), as well as get() Queries.
|
|
|
|
- Can now call make_transient() on an instance that
|
|
is referenced by parent objects via many-to-one,
|
|
without the parent's foreign key value getting
|
|
temporarily set to None - this was a function
|
|
of the "detect primary key switch" flush handler.
|
|
It now ignores objects that are no longer
|
|
in the "persistent" state, and the parent's
|
|
foreign key identifier is left unaffected.
|
|
|
|
- query.order_by() now accepts False, which cancels
|
|
any existing order_by() state on the Query, allowing
|
|
subsequent generative methods to be called which do
|
|
not support ORDER BY. This is not the same as the
|
|
already existing feature of passing None, which
|
|
suppresses any existing order_by() settings, including
|
|
those configured on the mapper. False will make it
|
|
as though order_by() was never called, while
|
|
None is an active setting.
|
|
|
|
- An instance which is moved to "transient", has
|
|
an incomplete or missing set of primary key
|
|
attributes, and contains expired attributes, will
|
|
raise an InvalidRequestError if an expired attribute
|
|
is accessed, instead of getting a recursion overflow.
|
|
|
|
- The make_transient() function is now in the generated
|
|
documentation.
|
|
|
|
- make_transient() removes all "loader" callables from
|
|
the state being made transient, removing any
|
|
"expired" state - all unloaded attributes reset back
|
|
to undefined, None/empty on access.
|
|
|
|
- sql
|
|
- The warning emitted by the Unicode and String types
|
|
with convert_unicode=True no longer embeds the actual
|
|
value passed. This so that the Python warning
|
|
registry does not continue to grow in size, the warning
|
|
is emitted once as per the warning filter settings,
|
|
and large string values don't pollute the output.
|
|
[ticket:1822]
|
|
|
|
- Fixed bug that would prevent overridden clause
|
|
compilation from working for "annotated" expression
|
|
elements, which are often generated by the ORM.
|
|
|
|
- The argument to "ESCAPE" of a LIKE operator or similar
|
|
is passed through render_literal_value(), which may
|
|
implement escaping of backslashes. [ticket:1400]
|
|
|
|
- Fixed bug in Enum type which blew away native_enum
|
|
flag when used with TypeDecorators or other adaption
|
|
scenarios.
|
|
|
|
- Inspector hits bind.connect() when invoked to ensure
|
|
initialize has been called. the internal name ".conn"
|
|
is changed to ".bind", since that's what it is.
|
|
|
|
- Modified the internals of "column annotation" such that
|
|
a custom Column subclass can safely override
|
|
_constructor to return Column, for the purposes of
|
|
making "configurational" column classes that aren't
|
|
involved in proxying, etc.
|
|
|
|
- Column.copy() takes along the "unique" attribute
|
|
among others, fixes [ticket:1829] regarding declarative
|
|
mixins
|
|
|
|
- postgresql
|
|
- render_literal_value() is overridden which escapes
|
|
backslashes, currently applies to the ESCAPE clause
|
|
of LIKE and similar expressions.
|
|
Ultimately this will have to detect the value of
|
|
"standard_conforming_strings" for full behavior.
|
|
[ticket:1400]
|
|
|
|
- Won't generate "CREATE TYPE" / "DROP TYPE" if
|
|
using types.Enum on a PG version prior to 8.3 -
|
|
the supports_native_enum flag is fully
|
|
honored. [ticket:1836]
|
|
|
|
- mysql
|
|
- MySQL dialect doesn't emit CAST() for MySQL version
|
|
detected < 4.0.2. This allows the unicode
|
|
check on connect to proceed. [ticket:1826]
|
|
|
|
- MySQL dialect now detects NO_BACKSLASH_ESCAPES sql
|
|
mode, in addition to ANSI_QUOTES.
|
|
|
|
- render_literal_value() is overridden which escapes
|
|
backslashes, currently applies to the ESCAPE clause
|
|
of LIKE and similar expressions. This behavior
|
|
is derived from detecting the value of
|
|
NO_BACKSLASH_ESCAPES. [ticket:1400]
|
|
|
|
- oracle:
|
|
- Fixed ora-8 compatibility flags such that they
|
|
don't cache a stale value from before the first
|
|
database connection actually occurs. [ticket:1819]
|
|
|
|
- Oracle's "native decimal" metadata begins to return
|
|
ambiguous typing information about numerics
|
|
when columns are embedded in subqueries as well
|
|
as when ROWNUM is consulted with subqueries, as we
|
|
do for limit/offset. We've added these ambiguous
|
|
conditions to the cx_oracle "convert to Decimal()"
|
|
handler, so that we receive numerics as Decimal
|
|
in more cases instead of as floats. These are
|
|
then converted, if requested, into Integer
|
|
or Float, or otherwise kept as the lossless
|
|
Decimal [ticket:1840].
|
|
|
|
- mssql
|
|
- If server_version_info is outside the usual
|
|
range of (8, ), (9, ), (10, ), a warning is emitted
|
|
which suggests checking that the FreeTDS version
|
|
configuration is using 7.0 or 8.0, not 4.2.
|
|
[ticket:1825]
|
|
|
|
- firebird
|
|
- Fixed incorrect signature in do_execute(), error
|
|
introduced in 0.6.1. [ticket:1823]
|
|
|
|
- Firebird dialect adds CHAR, VARCHAR types which
|
|
accept a "charset" flag, to support Firebird
|
|
"CHARACTER SET" clause. [ticket:1813]
|
|
|
|
- declarative
|
|
- Added support for @classproperty to provide
|
|
any kind of schema/mapping construct from a
|
|
declarative mixin, including columns with foreign
|
|
keys, relationships, column_property, deferred.
|
|
This solves all such issues on declarative mixins.
|
|
An error is raised if any MapperProperty subclass
|
|
is specified on a mixin without using @classproperty.
|
|
[ticket:1751] [ticket:1796] [ticket:1805]
|
|
|
|
- a mixin class can now define a column that matches
|
|
one which is present on a __table__ defined on a
|
|
subclass. It cannot, however, define one that is
|
|
not present in the __table__, and the error message
|
|
here now works. [ticket:1821]
|
|
|
|
- compiler extension
|
|
- The 'default' compiler is automatically copied over
|
|
when overriding the compilation of a built in
|
|
clause construct, so no KeyError is raised if the
|
|
user-defined compiler is specific to certain
|
|
backends and compilation for a different backend
|
|
is invoked. [ticket:1838]
|
|
|
|
- documentation
|
|
- Added documentation for the Inspector. [ticket:1820]
|
|
|
|
- Fixed @memoized_property and @memoized_instancemethod
|
|
decorators so that Sphinx documentation picks up
|
|
these attributes and methods, such as
|
|
ResultProxy.inserted_primary_key. [ticket:1830]
|
|
|
|
|
|
0.6.1
|
|
=====
|
|
- orm
|
|
- Fixed regression introduced in 0.6.0 involving improper
|
|
history accounting on mutable attributes. [ticket:1782]
|
|
|
|
- Fixed regression introduced in 0.6.0 unit of work refactor
|
|
that broke updates for bi-directional relationship()
|
|
with post_update=True. [ticket:1807]
|
|
|
|
- session.merge() will not expire attributes on the returned
|
|
instance if that instance is "pending". [ticket:1789]
|
|
|
|
- fixed __setstate__ method of CollectionAdapter to not
|
|
fail during deserialize where parent InstanceState not
|
|
yet unserialized. [ticket:1802]
|
|
|
|
- Added internal warning in case an instance without a
|
|
full PK happened to be expired and then was asked
|
|
to refresh. [ticket:1797]
|
|
|
|
- Added more aggressive caching to the mapper's usage of
|
|
UPDATE, INSERT, and DELETE expressions. Assuming the
|
|
statement has no per-object SQL expressions attached,
|
|
the expression objects are cached by the mapper after
|
|
the first create, and their compiled form is stored
|
|
persistently in a cache dictionary for the duration of
|
|
the related Engine. The cache is an LRUCache for the
|
|
rare case that a mapper receives an extremely
|
|
high number of different column patterns as UPDATEs.
|
|
|
|
- sql
|
|
- expr.in_() now accepts a text() construct as the argument.
|
|
Grouping parenthesis are added automatically, i.e. usage
|
|
is like `col.in_(text("select id from table"))`.
|
|
[ticket:1793]
|
|
|
|
- Columns of _Binary type (i.e. LargeBinary, BLOB, etc.)
|
|
will coerce a "basestring" on the right side into a
|
|
_Binary as well so that required DBAPI processing
|
|
takes place.
|
|
|
|
- Added table.add_is_dependent_on(othertable), allows manual
|
|
placement of dependency rules between two Table objects
|
|
for use within create_all(), drop_all(), sorted_tables.
|
|
[ticket:1801]
|
|
|
|
- Fixed bug that prevented implicit RETURNING from functioning
|
|
properly with composite primary key that contained zeroes.
|
|
[ticket:1778]
|
|
|
|
- Fixed errant space character when generating ADD CONSTRAINT
|
|
for a named UNIQUE constraint.
|
|
|
|
- Fixed "table" argument on constructor of ForeginKeyConstraint
|
|
[ticket:1571]
|
|
|
|
- Fixed bug in connection pool cursor wrapper whereby if a
|
|
cursor threw an exception on close(), the logging of the
|
|
message would fail. [ticket:1786]
|
|
|
|
- the _make_proxy() method of ColumnClause and Column now use
|
|
self.__class__ to determine the class of object to be returned
|
|
instead of hardcoding to ColumnClause/Column, making it slightly
|
|
easier to produce specific subclasses of these which work in
|
|
alias/subquery situations.
|
|
|
|
- func.XXX() doesn't inadvertently resolve to non-Function
|
|
classes (e.g. fixes func.text()). [ticket:1798]
|
|
|
|
- engines
|
|
- Fixed building the C extensions on Python 2.4. [ticket:1781]
|
|
|
|
- Pool classes will reuse the same "pool_logging_name" setting
|
|
after a dispose() occurs.
|
|
|
|
- Engine gains an "execution_options" argument and
|
|
update_execution_options() method, which will apply to
|
|
all connections generated by this engine.
|
|
|
|
- mysql
|
|
- func.sysdate() emits "SYSDATE()", i.e. with the ending
|
|
parenthesis, on MySQL. [ticket:1794]
|
|
|
|
- sqlite
|
|
- Fixed concatenation of constraints when "PRIMARY KEY"
|
|
constraint gets moved to column level due to SQLite
|
|
AUTOINCREMENT keyword being rendered. [ticket:1812]
|
|
|
|
- oracle
|
|
- Added a check for cx_oracle versions lower than version 5,
|
|
in which case the incompatible "output type handler" won't
|
|
be used. This will impact decimal accuracy and some
|
|
unicode handling issues. [ticket:1775]
|
|
|
|
- Fixed use_ansi=False mode, which was producing broken
|
|
WHERE clauses in pretty much all cases. [ticket:1790]
|
|
|
|
- Re-established support for Oracle 8 with cx_oracle,
|
|
including that use_ansi is set to False automatically,
|
|
NVARCHAR2 and NCLOB are not rendered for Unicode,
|
|
"native unicode" check doesn't fail, cx_oracle
|
|
"native unicode" mode is disabled, VARCHAR() is emitted
|
|
with bytes count instead of char count. [ticket:1808]
|
|
|
|
- oracle_xe 5 doesn't accept a Python unicode object in
|
|
its connect string in normal Python 2.x mode - so we coerce
|
|
to str() directly. non-ascii characters aren't supported
|
|
in connect strings here since we don't know what encoding
|
|
we could use. [ticket:1670]
|
|
|
|
- FOR UPDATE is emitted in the syntactically correct position
|
|
when limit/offset is used, i.e. the ROWNUM subquery.
|
|
However, Oracle can't really handle FOR UPDATE with ORDER BY
|
|
or with subqueries, so its still not very usable, but at
|
|
least SQLA gets the SQL past the Oracle parser.
|
|
[ticket:1815]
|
|
|
|
- firebird
|
|
- Added a label to the query used within has_table() and
|
|
has_sequence() to work with older versions of Firebird
|
|
that don't provide labels for result columns. [ticket:1521]
|
|
|
|
- Added integer coercion to the "type_conv" attribute when
|
|
passed via query string, so that it is properly interpreted
|
|
by Kinterbasdb. [ticket:1779]
|
|
|
|
- Added 'connection shutdown' to the list of exception strings
|
|
which indicate a dropped connection. [ticket:1646]
|
|
|
|
- sqlsoup
|
|
- the SqlSoup constructor accepts a `base` argument which specifies
|
|
the base class to use for mapped classes, the default being
|
|
`object`. [ticket:1783]
|
|
|
|
0.6.0
|
|
=====
|
|
|
|
- orm
|
|
- Unit of work internals have been rewritten. Units of work
|
|
with large numbers of objects interdependent objects
|
|
can now be flushed without recursion overflows
|
|
as there is no longer reliance upon recursive calls
|
|
[ticket:1081]. The number of internal structures now stays
|
|
constant for a particular session state, regardless of
|
|
how many relationships are present on mappings. The flow
|
|
of events now corresponds to a linear list of steps,
|
|
generated by the mappers and relationships based on actual
|
|
work to be done, filtered through a single topological sort
|
|
for correct ordering. Flush actions are assembled using
|
|
far fewer steps and less memory. [ticket:1742]
|
|
|
|
- Along with the UOW rewrite, this also removes an issue
|
|
introduced in 0.6beta3 regarding topological cycle detection
|
|
for units of work with long dependency cycles. We now use
|
|
an algorithm written by Guido (thanks Guido!).
|
|
|
|
- one-to-many relationships now maintain a list of positive
|
|
parent-child associations within the flush, preventing
|
|
previous parents marked as deleted from cascading a
|
|
delete or NULL foreign key set on those child objects,
|
|
despite the end-user not removing the child from the old
|
|
association. [ticket:1764]
|
|
|
|
- A collection lazy load will switch off default
|
|
eagerloading on the reverse many-to-one side, since
|
|
that loading is by definition unnecessary. [ticket:1495]
|
|
|
|
- Session.refresh() now does an equivalent expire()
|
|
on the given instance first, so that the "refresh-expire"
|
|
cascade is propagated. Previously, refresh() was
|
|
not affected in any way by the presence of "refresh-expire"
|
|
cascade. This is a change in behavior versus that
|
|
of 0.6beta2, where the "lockmode" flag passed to refresh()
|
|
would cause a version check to occur. Since the instance
|
|
is first expired, refresh() always upgrades the object
|
|
to the most recent version.
|
|
|
|
- The 'refresh-expire' cascade, when reaching a pending object,
|
|
will expunge the object if the cascade also includes
|
|
"delete-orphan", or will simply detach it otherwise.
|
|
[ticket:1754]
|
|
|
|
- id(obj) is no longer used internally within topological.py,
|
|
as the sorting functions now require hashable objects
|
|
only. [ticket:1756]
|
|
|
|
- The ORM will set the docstring of all generated descriptors
|
|
to None by default. This can be overridden using 'doc'
|
|
(or if using Sphinx, attribute docstrings work too).
|
|
|
|
- Added kw argument 'doc' to all mapper property callables
|
|
as well as Column(). Will assemble the string 'doc' as
|
|
the '__doc__' attribute on the descriptor.
|
|
|
|
- Usage of version_id_col on a backend that supports
|
|
cursor.rowcount for execute() but not executemany() now works
|
|
when a delete is issued (already worked for saves, since those
|
|
don't use executemany()). For a backend that doesn't support
|
|
cursor.rowcount at all, a warning is emitted the same
|
|
as with saves. [ticket:1761]
|
|
|
|
- The ORM now short-term caches the "compiled" form of
|
|
insert() and update() constructs when flushing lists of
|
|
objects of all the same class, thereby avoiding redundant
|
|
compilation per individual INSERT/UPDATE within an
|
|
individual flush() call.
|
|
|
|
- internal getattr(), setattr(), getcommitted() methods
|
|
on ColumnProperty, CompositeProperty, RelationshipProperty
|
|
have been underscored (i.e. are private), signature has
|
|
changed.
|
|
|
|
- engines
|
|
- The C extension now also works with DBAPIs which use custom
|
|
sequences as row (and not only tuples). [ticket:1757]
|
|
|
|
- sql
|
|
- Restored some bind-labeling logic from 0.5 which ensures
|
|
that tables with column names that overlap another column
|
|
of the form "<tablename>_<columnname>" won't produce
|
|
errors if column._label is used as a bind name during
|
|
an UPDATE. Test coverage which wasn't present in 0.5
|
|
has been added. [ticket:1755]
|
|
|
|
- somejoin.select(fold_equivalents=True) is no longer
|
|
deprecated, and will eventually be rolled into a more
|
|
comprehensive version of the feature for [ticket:1729].
|
|
|
|
- the Numeric type raises an *enormous* warning when expected
|
|
to convert floats to Decimal from a DBAPI that returns floats.
|
|
This includes SQLite, Sybase, MS-SQL. [ticket:1759]
|
|
|
|
- Fixed an error in expression typing which caused an endless
|
|
loop for expressions with two NULL types.
|
|
|
|
- Fixed bug in execution_options() feature whereby the existing
|
|
Transaction and other state information from the parent
|
|
connection would not be propagated to the sub-connection.
|
|
|
|
- Added new 'compiled_cache' execution option. A dictionary
|
|
where Compiled objects will be cached when the Connection
|
|
compiles a clause expression into a dialect- and parameter-
|
|
specific Compiled object. It is the user's responsibility to
|
|
manage the size of this dictionary, which will have keys
|
|
corresponding to the dialect, clause element, the column
|
|
names within the VALUES or SET clause of an INSERT or UPDATE,
|
|
as well as the "batch" mode for an INSERT or UPDATE statement.
|
|
|
|
- Added get_pk_constraint() to reflection.Inspector, similar
|
|
to get_primary_keys() except returns a dict that includes the
|
|
name of the constraint, for supported backends (PG so far).
|
|
[ticket:1769]
|
|
|
|
- Table.create() and Table.drop() no longer apply metadata-
|
|
level create/drop events. [ticket:1771]
|
|
|
|
- ext
|
|
- the compiler extension now allows @compiles decorators
|
|
on base classes that extend to child classes, @compiles
|
|
decorators on child classes that aren't broken by a
|
|
@compiles decorator on the base class.
|
|
|
|
- Declarative will raise an informative error message
|
|
if a non-mapped class attribute is referenced in the
|
|
string-based relationship() arguments.
|
|
|
|
- Further reworked the "mixin" logic in declarative to
|
|
additionally allow __mapper_args__ as a @classproperty
|
|
on a mixin, such as to dynamically assign polymorphic_identity.
|
|
|
|
- postgresql
|
|
- Postgresql now reflects sequence names associated with
|
|
SERIAL columns correctly, after the name of of the sequence
|
|
has been changed. Thanks to Kumar McMillan for the patch.
|
|
[ticket:1071]
|
|
|
|
- Repaired missing import in psycopg2._PGNumeric type when
|
|
unknown numeric is received.
|
|
|
|
- psycopg2/pg8000 dialects now aware of REAL[], FLOAT[],
|
|
DOUBLE_PRECISION[], NUMERIC[] return types without
|
|
raising an exception.
|
|
|
|
- Postgresql reflects the name of primary key constraints,
|
|
if one exists. [ticket:1769]
|
|
|
|
- oracle
|
|
- Now using cx_oracle output converters so that the
|
|
DBAPI returns natively the kinds of values we prefer:
|
|
- NUMBER values with positive precision + scale convert
|
|
to cx_oracle.STRING and then to Decimal. This
|
|
allows perfect precision for the Numeric type when
|
|
using cx_oracle. [ticket:1759]
|
|
- STRING/FIXED_CHAR now convert to unicode natively.
|
|
SQLAlchemy's String types then don't need to
|
|
apply any kind of conversions.
|
|
|
|
- firebird
|
|
- The functionality of result.rowcount can be disabled on a
|
|
per-engine basis by setting 'enable_rowcount=False'
|
|
on create_engine(). Normally, cursor.rowcount is called
|
|
after any UPDATE or DELETE statement unconditionally,
|
|
because the cursor is then closed and Firebird requires
|
|
an open cursor in order to get a rowcount. This
|
|
call is slightly expensive however so it can be disabled.
|
|
To re-enable on a per-execution basis, the
|
|
'enable_rowcount=True' execution option may be used.
|
|
|
|
- examples
|
|
- Updated attribute_shard.py example to use a more robust
|
|
method of searching a Query for binary expressions which
|
|
compare columns against literal values.
|
|
|
|
0.6beta3
|
|
========
|
|
|
|
- orm
|
|
- Major feature: Added new "subquery" loading capability to
|
|
relationship(). This is an eager loading option which
|
|
generates a second SELECT for each collection represented
|
|
in a query, across all parents at once. The query
|
|
re-issues the original end-user query wrapped in a subquery,
|
|
applies joins out to the target collection, and loads
|
|
all those collections fully in one result, similar to
|
|
"joined" eager loading but using all inner joins and not
|
|
re-fetching full parent rows repeatedly (as most DBAPIs seem
|
|
to do, even if columns are skipped). Subquery loading is
|
|
available at mapper config level using "lazy='subquery'" and
|
|
at the query options level using "subqueryload(props..)",
|
|
"subqueryload_all(props...)". [ticket:1675]
|
|
|
|
- To accomodate the fact that there are now two kinds of eager
|
|
loading available, the new names for eagerload() and
|
|
eagerload_all() are joinedload() and joinedload_all(). The
|
|
old names will remain as synonyms for the foreseeable future.
|
|
|
|
- The "lazy" flag on the relationship() function now accepts
|
|
a string argument for all kinds of loading: "select", "joined",
|
|
"subquery", "noload" and "dynamic", where the default is now
|
|
"select". The old values of True/
|
|
False/None still retain their usual meanings and will remain
|
|
as synonyms for the foreseeable future.
|
|
|
|
- Added with_hint() method to Query() construct. This calls
|
|
directly down to select().with_hint() and also accepts
|
|
entities as well as tables and aliases. See with_hint() in the
|
|
SQL section below. [ticket:921]
|
|
|
|
- Fixed bug in Query whereby calling q.join(prop).from_self(...).
|
|
join(prop) would fail to render the second join outside the
|
|
subquery, when joining on the same criterion as was on the
|
|
inside.
|
|
|
|
- Fixed bug in Query whereby the usage of aliased() constructs
|
|
would fail if the underlying table (but not the actual alias)
|
|
were referenced inside the subquery generated by
|
|
q.from_self() or q.select_from().
|
|
|
|
- Fixed bug which affected all eagerload() and similar options
|
|
such that "remote" eager loads, i.e. eagerloads off of a lazy
|
|
load such as query(A).options(eagerload(A.b, B.c))
|
|
wouldn't eagerload anything, but using eagerload("b.c") would
|
|
work fine.
|
|
|
|
- Query gains an add_columns(*columns) method which is a multi-
|
|
version of add_column(col). add_column(col) is future
|
|
deprecated.
|
|
|
|
- Query.join() will detect if the end result will be
|
|
"FROM A JOIN A", and will raise an error if so.
|
|
|
|
- Query.join(Cls.propname, from_joinpoint=True) will check more
|
|
carefully that "Cls" is compatible with the current joinpoint,
|
|
and act the same way as Query.join("propname", from_joinpoint=True)
|
|
in that regard.
|
|
|
|
- sql
|
|
- Added with_hint() method to select() construct. Specify
|
|
a table/alias, hint text, and optional dialect name, and
|
|
"hints" will be rendered in the appropriate place in the
|
|
statement. Works for Oracle, Sybase, MySQL. [ticket:921]
|
|
|
|
- Fixed bug introduced in 0.6beta2 where column labels would
|
|
render inside of column expressions already assigned a label.
|
|
[ticket:1747]
|
|
|
|
- postgresql
|
|
- The psycopg2 dialect will log NOTICE messages via the
|
|
"sqlalchemy.dialects.postgresql" logger name.
|
|
[ticket:877]
|
|
|
|
- the TIME and TIMESTAMP types are now availble from the
|
|
postgresql dialect directly, which add the PG-specific
|
|
argument 'precision' to both. 'precision' and
|
|
'timezone' are correctly reflected for both TIME and
|
|
TIMEZONE types. [ticket:997]
|
|
|
|
- mysql
|
|
- No longer guessing that TINYINT(1) should be BOOLEAN
|
|
when reflecting - TINYINT(1) is returned. Use Boolean/
|
|
BOOLEAN in table definition to get boolean conversion
|
|
behavior. [ticket:1752]
|
|
|
|
- oracle
|
|
- The Oracle dialect will issue VARCHAR type definitions
|
|
using character counts, i.e. VARCHAR2(50 CHAR), so that
|
|
the column is sized in terms of characters and not bytes.
|
|
Column reflection of character types will also use
|
|
ALL_TAB_COLUMNS.CHAR_LENGTH instead of
|
|
ALL_TAB_COLUMNS.DATA_LENGTH. Both of these behaviors take
|
|
effect when the server version is 9 or higher - for
|
|
version 8, the old behaviors are used. [ticket:1744]
|
|
|
|
- declarative
|
|
- Using a mixin won't break if the mixin implements an
|
|
unpredictable __getattribute__(), i.e. Zope interfaces.
|
|
[ticket:1746]
|
|
|
|
- Using @classdecorator and similar on mixins to define
|
|
__tablename__, __table_args__, etc. now works if
|
|
the method references attributes on the ultimate
|
|
subclass. [ticket:1749]
|
|
|
|
- relationships and columns with foreign keys aren't
|
|
allowed on declarative mixins, sorry. [ticket:1751]
|
|
|
|
- ext
|
|
- The sqlalchemy.orm.shard module now becomes an extension,
|
|
sqlalchemy.ext.horizontal_shard. The old import
|
|
works with a deprecation warning.
|
|
|
|
0.6beta2
|
|
========
|
|
|
|
- py3k
|
|
- Improved the installation/test setup regarding Python 3,
|
|
now that Distribute runs on Py3k. distribute_setup.py
|
|
is now included. See README.py3k for Python 3 installation/
|
|
testing instructions.
|
|
|
|
- orm
|
|
- The official name for the relation() function is now
|
|
relationship(), to eliminate confusion over the relational
|
|
algebra term. relation() however will remain available
|
|
in equal capacity for the foreseeable future. [ticket:1740]
|
|
|
|
- Added "version_id_generator" argument to Mapper, this is a
|
|
callable that, given the current value of the "version_id_col",
|
|
returns the next version number. Can be used for alternate
|
|
versioning schemes such as uuid, timestamps. [ticket:1692]
|
|
|
|
- added "lockmode" kw argument to Session.refresh(), will
|
|
pass through the string value to Query the same as
|
|
in with_lockmode(), will also do version check for a
|
|
version_id_col-enabled mapping.
|
|
|
|
- Fixed bug whereby calling query(A).join(A.bs).add_entity(B)
|
|
in a joined inheritance scenario would double-add B as a
|
|
target and produce an invalid query. [ticket:1188]
|
|
|
|
- Fixed bug in session.rollback() which involved not removing
|
|
formerly "pending" objects from the session before
|
|
re-integrating "deleted" objects, typically occured with
|
|
natural primary keys. If there was a primary key conflict
|
|
between them, the attach of the deleted would fail
|
|
internally. The formerly "pending" objects are now expunged
|
|
first. [ticket:1674]
|
|
|
|
- Removed a lot of logging that nobody really cares about,
|
|
logging that remains will respond to live changes in the
|
|
log level. No significant overhead is added. [ticket:1719]
|
|
|
|
- Fixed bug in session.merge() which prevented dict-like
|
|
collections from merging.
|
|
|
|
- session.merge() works with relations that specifically
|
|
don't include "merge" in their cascade options - the target
|
|
is ignored completely.
|
|
|
|
- session.merge() will not expire existing scalar attributes
|
|
on an existing target if the target has a value for that
|
|
attribute, even if the incoming merged doesn't have
|
|
a value for the attribute. This prevents unnecessary loads
|
|
on existing items. Will still mark the attr as expired
|
|
if the destination doesn't have the attr, though, which
|
|
fulfills some contracts of deferred cols. [ticket:1681]
|
|
|
|
- The "allow_null_pks" flag is now called "allow_partial_pks",
|
|
defaults to True, acts like it did in 0.5 again. Except,
|
|
it also is implemented within merge() such that a SELECT
|
|
won't be issued for an incoming instance with partially
|
|
NULL primary key if the flag is False. [ticket:1680]
|
|
|
|
- Fixed bug in 0.6-reworked "many-to-one" optimizations
|
|
such that a many-to-one that is against a non-primary key
|
|
column on the remote table (i.e. foreign key against a
|
|
UNIQUE column) will pull the "old" value in from the
|
|
database during a change, since if it's in the session
|
|
we will need it for proper history/backref accounting,
|
|
and we can't pull from the local identity map on a
|
|
non-primary key column. [ticket:1737]
|
|
|
|
- fixed internal error which would occur if calling has()
|
|
or similar complex expression on a single-table inheritance
|
|
relation(). [ticket:1731]
|
|
|
|
- query.one() no longer applies LIMIT to the query, this to
|
|
ensure that it fully counts all object identities present
|
|
in the result, even in the case where joins may conceal
|
|
multiple identities for two or more rows. As a bonus,
|
|
one() can now also be called with a query that issued
|
|
from_statement() to start with since it no longer modifies
|
|
the query. [ticket:1688]
|
|
|
|
- query.get() now returns None if queried for an identifier
|
|
that is present in the identity map with a different class
|
|
than the one requested, i.e. when using polymorphic loading.
|
|
[ticket:1727]
|
|
|
|
- A major fix in query.join(), when the "on" clause is an
|
|
attribute of an aliased() construct, but there is already
|
|
an existing join made out to a compatible target, query properly
|
|
joins to the right aliased() construct instead of sticking
|
|
onto the right side of the existing join. [ticket:1706]
|
|
|
|
- Slight improvement to the fix for [ticket:1362] to not issue
|
|
needless updates of the primary key column during a so-called
|
|
"row switch" operation, i.e. add + delete of two objects
|
|
with the same PK.
|
|
|
|
- Now uses sqlalchemy.orm.exc.DetachedInstanceError when an
|
|
attribute load or refresh action fails due to object
|
|
being detached from any Session. UnboundExecutionError
|
|
is specific to engines bound to sessions and statements.
|
|
|
|
- Query called in the context of an expression will render
|
|
disambiguating labels in all cases. Note that this does
|
|
not apply to the existing .statement and .subquery()
|
|
accessor/method, which still honors the .with_labels()
|
|
setting that defaults to False.
|
|
|
|
- Query.union() retains disambiguating labels within the
|
|
returned statement, thus avoiding various SQL composition
|
|
errors which can result from column name conflicts.
|
|
[ticket:1676]
|
|
|
|
- Fixed bug in attribute history that inadvertently invoked
|
|
__eq__ on mapped instances.
|
|
|
|
- Some internal streamlining of object loading grants a
|
|
small speedup for large results, estimates are around
|
|
10-15%. Gave the "state" internals a good solid
|
|
cleanup with less complexity, datamembers,
|
|
method calls, blank dictionary creates.
|
|
|
|
- Documentation clarification for query.delete()
|
|
[ticket:1689]
|
|
|
|
- Fixed cascade bug in many-to-one relation() when attribute
|
|
was set to None, introduced in r6711 (cascade deleted
|
|
items into session during add()).
|
|
|
|
- Calling query.order_by() or query.distinct() before calling
|
|
query.select_from(), query.with_polymorphic(), or
|
|
query.from_statement() raises an exception now instead of
|
|
silently dropping those criterion. [ticket:1736]
|
|
|
|
- query.scalar() now raises an exception if more than one
|
|
row is returned. All other behavior remains the same.
|
|
[ticket:1735]
|
|
|
|
- Fixed bug which caused "row switch" logic, that is an
|
|
INSERT and DELETE replaced by an UPDATE, to fail when
|
|
version_id_col was in use. [ticket:1692]
|
|
|
|
- sql
|
|
- join() will now simulate a NATURAL JOIN by default. Meaning,
|
|
if the left side is a join, it will attempt to join the right
|
|
side to the rightmost side of the left first, and not raise
|
|
any exceptions about ambiguous join conditions if successful
|
|
even if there are further join targets across the rest of
|
|
the left. [ticket:1714]
|
|
|
|
- The most common result processors conversion function were
|
|
moved to the new "processors" module. Dialect authors are
|
|
encouraged to use those functions whenever they correspond
|
|
to their needs instead of implementing custom ones.
|
|
|
|
- SchemaType and subclasses Boolean, Enum are now serializable,
|
|
including their ddl listener and other event callables.
|
|
[ticket:1694] [ticket:1698]
|
|
|
|
- Some platforms will now interpret certain literal values
|
|
as non-bind parameters, rendered literally into the SQL
|
|
statement. This to support strict SQL-92 rules that are
|
|
enforced by some platforms including MS-SQL and Sybase.
|
|
In this model, bind parameters aren't allowed in the
|
|
columns clause of a SELECT, nor are certain ambiguous
|
|
expressions like "?=?". When this mode is enabled, the base
|
|
compiler will render the binds as inline literals, but only across
|
|
strings and numeric values. Other types such as dates
|
|
will raise an error, unless the dialect subclass defines
|
|
a literal rendering function for those. The bind parameter
|
|
must have an embedded literal value already or an error
|
|
is raised (i.e. won't work with straight bindparam('x')).
|
|
Dialects can also expand upon the areas where binds are not
|
|
accepted, such as within argument lists of functions
|
|
(which don't work on MS-SQL when native SQL binding is used).
|
|
|
|
- Added "unicode_errors" parameter to String, Unicode, etc.
|
|
Behaves like the 'errors' keyword argument to
|
|
the standard library's string.decode() functions. This flag
|
|
requires that `convert_unicode` is set to `"force"` - otherwise,
|
|
SQLAlchemy is not guaranteed to handle the task of unicode
|
|
conversion. Note that this flag adds significant performance
|
|
overhead to row-fetching operations for backends that already
|
|
return unicode objects natively (which most DBAPIs do). This
|
|
flag should only be used as an absolute last resort for reading
|
|
strings from a column with varied or corrupted encodings,
|
|
which only applies to databases that accept invalid encodings
|
|
in the first place (i.e. MySQL. *not* PG, Sqlite, etc.)
|
|
|
|
- Added math negation operator support, -x.
|
|
|
|
- FunctionElement subclasses are now directly executable the
|
|
same way any func.foo() construct is, with automatic
|
|
SELECT being applied when passed to execute().
|
|
|
|
- The "type" and "bind" keyword arguments of a func.foo()
|
|
construct are now local to "func." constructs and are
|
|
not part of the FunctionElement base class, allowing
|
|
a "type" to be handled in a custom constructor or
|
|
class-level variable.
|
|
|
|
- Restored the keys() method to ResultProxy.
|
|
|
|
- The type/expression system now does a more complete job
|
|
of determining the return type from an expression
|
|
as well as the adaptation of the Python operator into
|
|
a SQL operator, based on the full left/right/operator
|
|
of the given expression. In particular
|
|
the date/time/interval system created for Postgresql
|
|
EXTRACT in [ticket:1647] has now been generalized into
|
|
the type system. The previous behavior which often
|
|
occured of an expression "column + literal" forcing
|
|
the type of "literal" to be the same as that of "column"
|
|
will now usually not occur - the type of
|
|
"literal" is first derived from the Python type of the
|
|
literal, assuming standard native Python types + date
|
|
types, before falling back to that of the known type
|
|
on the other side of the expression. If the
|
|
"fallback" type is compatible (i.e. CHAR from String),
|
|
the literal side will use that. TypeDecorator
|
|
types override this by default to coerce the "literal"
|
|
side unconditionally, which can be changed by implementing
|
|
the coerce_compared_value() method. Also part of
|
|
[ticket:1683].
|
|
|
|
- Made sqlalchemy.sql.expressions.Executable part of public
|
|
API, used for any expression construct that can be sent to
|
|
execute(). FunctionElement now inherits Executable so that
|
|
it gains execution_options(), which are also propagated
|
|
to the select() that's generated within execute().
|
|
Executable in turn subclasses _Generative which marks
|
|
any ClauseElement that supports the @_generative
|
|
decorator - these may also become "public" for the benefit
|
|
of the compiler extension at some point.
|
|
|
|
- A change to the solution for [ticket:1579] - an end-user
|
|
defined bind parameter name that directly conflicts with
|
|
a column-named bind generated directly from the SET or
|
|
VALUES clause of an update/insert generates a compile error.
|
|
This reduces call counts and eliminates some cases where
|
|
undesirable name conflicts could still occur.
|
|
|
|
- Column() requires a type if it has no foreign keys (this is
|
|
not new). An error is now raised if a Column() has no type
|
|
and no foreign keys. [ticket:1705]
|
|
|
|
- the "scale" argument of the Numeric() type is honored when
|
|
coercing a returned floating point value into a string
|
|
on its way to Decimal - this allows accuracy to function
|
|
on SQLite, MySQL. [ticket:1717]
|
|
|
|
- the copy() method of Column now copies over uninitialized
|
|
"on table attach" events. Helps with the new declarative
|
|
"mixin" capability.
|
|
|
|
- engines
|
|
- Added an optional C extension to speed up the sql layer by
|
|
reimplementing RowProxy and the most common result processors.
|
|
The actual speedups will depend heavily on your DBAPI and
|
|
the mix of datatypes used in your tables, and can vary from
|
|
a 30% improvement to more than 200%. It also provides a modest
|
|
(~15-20%) indirect improvement to ORM speed for large queries.
|
|
Note that it is *not* built/installed by default.
|
|
See README for installation instructions.
|
|
|
|
- the execution sequence pulls all rowcount/last inserted ID
|
|
info from the cursor before commit() is called on the
|
|
DBAPI connection in an "autocommit" scenario. This helps
|
|
mxodbc with rowcount and is probably a good idea overall.
|
|
|
|
- Opened up logging a bit such that isEnabledFor() is called
|
|
more often, so that changes to the log level for engine/pool
|
|
will be reflected on next connect. This adds a small
|
|
amount of method call overhead. It's negligible and will make
|
|
life a lot easier for all those situations when logging
|
|
just happens to be configured after create_engine() is called.
|
|
[ticket:1719]
|
|
|
|
- The assert_unicode flag is deprecated. SQLAlchemy will raise
|
|
a warning in all cases where it is asked to encode a non-unicode
|
|
Python string, as well as when a Unicode or UnicodeType type
|
|
is explicitly passed a bytestring. The String type will do nothing
|
|
for DBAPIs that already accept Python unicode objects.
|
|
|
|
- Bind parameters are sent as a tuple instead of a list. Some
|
|
backend drivers will not accept bind parameters as a list.
|
|
|
|
- threadlocal engine wasn't properly closing the connection
|
|
upon close() - fixed that.
|
|
|
|
- Transaction object doesn't rollback or commit if it isn't
|
|
"active", allows more accurate nesting of begin/rollback/commit.
|
|
|
|
- Python unicode objects as binds result in the Unicode type,
|
|
not string, thus eliminating a certain class of unicode errors
|
|
on drivers that don't support unicode binds.
|
|
|
|
- Added "logging_name" argument to create_engine(), Pool() constructor
|
|
as well as "pool_logging_name" argument to create_engine() which
|
|
filters down to that of Pool. Issues the given string name
|
|
within the "name" field of logging messages instead of the default
|
|
hex identifier string. [ticket:1555]
|
|
|
|
- The visit_pool() method of Dialect is removed, and replaced with
|
|
on_connect(). This method returns a callable which receives
|
|
the raw DBAPI connection after each one is created. The callable
|
|
is assembled into a first_connect/connect pool listener by the
|
|
connection strategy if non-None. Provides a simpler interface
|
|
for dialects.
|
|
|
|
- StaticPool now initializes, disposes and recreates without
|
|
opening a new connection - the connection is only opened when
|
|
first requested. dispose() also works on AssertionPool now.
|
|
[ticket:1728]
|
|
|
|
- metadata
|
|
- Added the ability to strip schema information when using
|
|
"tometadata" by passing "schema=None" as an argument. If schema
|
|
is not specified then the table's schema is retained.
|
|
[ticket: 1673]
|
|
|
|
- declarative
|
|
- DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
|
|
as the source of class information; _as_declarative exclusively
|
|
uses the dict_ passed to it as the source of class information
|
|
(which when using DeclarativeMeta is cls.__dict__). This should
|
|
in theory make it easier for custom metaclasses to modify
|
|
the state passed into _as_declarative.
|
|
|
|
- declarative now accepts mixin classes directly, as a means
|
|
to provide common functional and column-based elements on
|
|
all subclasses, as well as a means to propagate a fixed
|
|
set of __table_args__ or __mapper_args__ to subclasses.
|
|
For custom combinations of __table_args__/__mapper_args__ from
|
|
an inherited mixin to local, descriptors can now be used.
|
|
New details are all up in the Declarative documentation.
|
|
Thanks to Chris Withers for putting up with my strife
|
|
on this. [ticket:1707]
|
|
|
|
- the __mapper_args__ dict is copied when propagating to a subclass,
|
|
and is taken straight off the class __dict__ to avoid any
|
|
propagation from the parent. mapper inheritance already
|
|
propagates the things you want from the parent mapper.
|
|
[ticket:1393]
|
|
|
|
- An exception is raised when a single-table subclass specifies
|
|
a column that is already present on the base class.
|
|
[ticket:1732]
|
|
|
|
- mysql
|
|
- Fixed reflection bug whereby when COLLATE was present,
|
|
nullable flag and server defaults would not be reflected.
|
|
[ticket:1655]
|
|
|
|
- Fixed reflection of TINYINT(1) "boolean" columns defined with
|
|
integer flags like UNSIGNED.
|
|
|
|
- Further fixes for the mysql-connector dialect. [ticket:1668]
|
|
|
|
- Composite PK table on InnoDB where the "autoincrement" column
|
|
isn't first will emit an explicit "KEY" phrase within
|
|
CREATE TABLE thereby avoiding errors, [ticket:1496]
|
|
|
|
- Added reflection/create table support for a wide range
|
|
of MySQL keywords. [ticket:1634]
|
|
|
|
- Fixed import error which could occur reflecting tables on
|
|
a Windows host [ticket:1580]
|
|
|
|
- mssql
|
|
- Re-established support for the pymssql dialect.
|
|
|
|
- Various fixes for implicit returning, reflection,
|
|
etc. - the MS-SQL dialects aren't quite complete
|
|
in 0.6 yet (but are close)
|
|
|
|
- Added basic support for mxODBC [ticket:1710].
|
|
|
|
- Removed the text_as_varchar option.
|
|
|
|
- oracle
|
|
- "out" parameters require a type that is supported by
|
|
cx_oracle. An error will be raised if no cx_oracle
|
|
type can be found.
|
|
|
|
- Oracle 'DATE' now does not perform any result processing,
|
|
as the DATE type in Oracle stores full date+time objects,
|
|
that's what you'll get. Note that the generic types.Date
|
|
type *will* still call value.date() on incoming values,
|
|
however. When reflecting a table, the reflected type
|
|
will be 'DATE'.
|
|
|
|
- Added preliminary support for Oracle's WITH_UNICODE
|
|
mode. At the very least this establishes initial
|
|
support for cx_Oracle with Python 3. When WITH_UNICODE
|
|
mode is used in Python 2.xx, a large and scary warning
|
|
is emitted asking that the user seriously consider
|
|
the usage of this difficult mode of operation.
|
|
[ticket:1670]
|
|
|
|
- The except_() method now renders as MINUS on Oracle,
|
|
which is more or less equivalent on that platform.
|
|
[ticket:1712]
|
|
|
|
- Added support for rendering and reflecting
|
|
TIMESTAMP WITH TIME ZONE, i.e. TIMESTAMP(timezone=True).
|
|
[ticket:651]
|
|
|
|
- Oracle INTERVAL type can now be reflected.
|
|
|
|
- sqlite
|
|
- Added "native_datetime=True" flag to create_engine().
|
|
This will cause the DATE and TIMESTAMP types to skip
|
|
all bind parameter and result row processing, under
|
|
the assumption that PARSE_DECLTYPES has been enabled
|
|
on the connection. Note that this is not entirely
|
|
compatible with the "func.current_date()", which
|
|
will be returned as a string. [ticket:1685]
|
|
|
|
- sybase
|
|
- Implemented a preliminary working dialect for Sybase,
|
|
with sub-implementations for Python-Sybase as well
|
|
as Pyodbc. Handles table
|
|
creates/drops and basic round trip functionality.
|
|
Does not yet include reflection or comprehensive
|
|
support of unicode/special expressions/etc.
|
|
|
|
- examples
|
|
- Changed the beaker cache example a bit to have a separate
|
|
RelationCache option for lazyload caching. This object
|
|
does a lookup among any number of potential attributes
|
|
more efficiently by grouping several into a common structure.
|
|
Both FromCache and RelationCache are simpler individually.
|
|
|
|
- documentation
|
|
- Major cleanup work in the docs to link class, function, and
|
|
method names into the API docs. [ticket:1700/1702/1703]
|
|
|
|
0.6beta1
|
|
========
|
|
- Major Release
|
|
- For the full set of feature descriptions, see
|
|
http://www.sqlalchemy.org/trac/wiki/06Migration .
|
|
This document is a work in progress.
|
|
|
|
- All bug fixes and feature enhancements from the most
|
|
recent 0.5 version and below are also included within 0.6.
|
|
|
|
- Platforms targeted now include Python 2.4/2.5/2.6, Python
|
|
3.1, Jython2.5.
|
|
|
|
- orm
|
|
- Changes to query.update() and query.delete():
|
|
- the 'expire' option on query.update() has been renamed to
|
|
'fetch', thus matching that of query.delete().
|
|
'expire' is deprecated and issues a warning.
|
|
|
|
- query.update() and query.delete() both default to
|
|
'evaluate' for the synchronize strategy.
|
|
|
|
- the 'synchronize' strategy for update() and delete()
|
|
raises an error on failure. There is no implicit fallback
|
|
onto "fetch". Failure of evaluation is based on the
|
|
structure of criteria, so success/failure is deterministic
|
|
based on code structure.
|
|
|
|
- Enhancements on many-to-one relations:
|
|
- many-to-one relations now fire off a lazyload in fewer
|
|
cases, including in most cases will not fetch the "old"
|
|
value when a new one is replaced.
|
|
|
|
- many-to-one relation to a joined-table subclass now uses
|
|
get() for a simple load (known as the "use_get"
|
|
condition), i.e. Related->Sub(Base), without the need to
|
|
redefine the primaryjoin condition in terms of the base
|
|
table. [ticket:1186]
|
|
|
|
- specifying a foreign key with a declarative column, i.e.
|
|
ForeignKey(MyRelatedClass.id) doesn't break the "use_get"
|
|
condition from taking place [ticket:1492]
|
|
|
|
- relation(), eagerload(), and eagerload_all() now feature
|
|
an option called "innerjoin". Specify `True` or `False` to
|
|
control whether an eager join is constructed as an INNER
|
|
or OUTER join. Default is `False` as always. The mapper
|
|
options will override whichever setting is specified on
|
|
relation(). Should generally be set for many-to-one, not
|
|
nullable foreign key relations to allow improved join
|
|
performance. [ticket:1544]
|
|
|
|
- the behavior of eagerloading such that the main query is
|
|
wrapped in a subquery when LIMIT/OFFSET are present now
|
|
makes an exception for the case when all eager loads are
|
|
many-to-one joins. In those cases, the eager joins are
|
|
against the parent table directly along with the
|
|
limit/offset without the extra overhead of a subquery,
|
|
since a many-to-one join does not add rows to the result.
|
|
|
|
- Enhancements / Changes on Session.merge():
|
|
- the "dont_load=True" flag on Session.merge() is deprecated
|
|
and is now "load=False".
|
|
|
|
- Session.merge() is performance optimized, using half the
|
|
call counts for "load=False" mode compared to 0.5 and
|
|
significantly fewer SQL queries in the case of collections
|
|
for "load=True" mode.
|
|
|
|
- merge() will not issue a needless merge of attributes if the
|
|
given instance is the same instance which is already present.
|
|
|
|
- merge() now also merges the "options" associated with a given
|
|
state, i.e. those passed through query.options() which follow
|
|
along with an instance, such as options to eagerly- or
|
|
lazyily- load various attributes. This is essential for
|
|
the construction of highly integrated caching schemes. This
|
|
is a subtle behavioral change vs. 0.5.
|
|
|
|
- A bug was fixed regarding the serialization of the "loader
|
|
path" present on an instance's state, which is also necessary
|
|
when combining the usage of merge() with serialized state
|
|
and associated options that should be preserved.
|
|
|
|
- The all new merge() is showcased in a new comprehensive
|
|
example of how to integrate Beaker with SQLAlchemy. See
|
|
the notes in the "examples" note below.
|
|
|
|
- Primary key values can now be changed on a joined-table inheritance
|
|
object, and ON UPDATE CASCADE will be taken into account when
|
|
the flush happens. Set the new "passive_updates" flag to False
|
|
on mapper() when using SQLite or MySQL/MyISAM. [ticket:1362]
|
|
|
|
- flush() now detects when a primary key column was updated by
|
|
an ON UPDATE CASCADE operation from another primary key, and
|
|
can then locate the row for a subsequent UPDATE on the new PK
|
|
value. This occurs when a relation() is there to establish
|
|
the relationship as well as passive_updates=True. [ticket:1671]
|
|
|
|
- the "save-update" cascade will now cascade the pending *removed*
|
|
values from a scalar or collection attribute into the new session
|
|
during an add() operation. This so that the flush() operation
|
|
will also delete or modify rows of those disconnected items.
|
|
|
|
- Using a "dynamic" loader with a "secondary" table now produces
|
|
a query where the "secondary" table is *not* aliased. This
|
|
allows the secondary Table object to be used in the "order_by"
|
|
attribute of the relation(), and also allows it to be used
|
|
in filter criterion against the dynamic relation.
|
|
[ticket:1531]
|
|
|
|
- relation() with uselist=False will emit a warning when
|
|
an eager or lazy load locates more than one valid value for
|
|
the row. This may be due to primaryjoin/secondaryjoin
|
|
conditions which aren't appropriate for an eager LEFT OUTER
|
|
JOIN or for other conditions. [ticket:1643]
|
|
|
|
- an explicit check occurs when a synonym() is used with
|
|
map_column=True, when a ColumnProperty (deferred or otherwise)
|
|
exists separately in the properties dictionary sent to mapper
|
|
with the same keyname. Instead of silently replacing
|
|
the existing property (and possible options on that property),
|
|
an error is raised. [ticket:1633]
|
|
|
|
- a "dynamic" loader sets up its query criterion at construction
|
|
time so that the actual query is returned from non-cloning
|
|
accessors like "statement".
|
|
|
|
- the "named tuple" objects returned when iterating a
|
|
Query() are now pickleable.
|
|
|
|
- mapping to a select() construct now requires that you
|
|
make an alias() out of it distinctly. This to eliminate
|
|
confusion over such issues as [ticket:1542]
|
|
|
|
- query.join() has been reworked to provide more consistent
|
|
behavior and more flexibility (includes [ticket:1537])
|
|
|
|
- query.select_from() accepts multiple clauses to produce
|
|
multiple comma separated entries within the FROM clause.
|
|
Useful when selecting from multiple-homed join() clauses.
|
|
|
|
- query.select_from() also accepts mapped classes, aliased()
|
|
constructs, and mappers as arguments. In particular this
|
|
helps when querying from multiple joined-table classes to ensure
|
|
the full join gets rendered.
|
|
|
|
- query.get() can be used with a mapping to an outer join
|
|
where one or more of the primary key values are None.
|
|
[ticket:1135]
|
|
|
|
- query.from_self(), query.union(), others which do a
|
|
"SELECT * from (SELECT...)" type of nesting will do
|
|
a better job translating column expressions within the subquery
|
|
to the columns clause of the outer query. This is
|
|
potentially backwards incompatible with 0.5, in that this
|
|
may break queries with literal expressions that do not have labels
|
|
applied (i.e. literal('foo'), etc.)
|
|
[ticket:1568]
|
|
|
|
- relation primaryjoin and secondaryjoin now check that they
|
|
are column-expressions, not just clause elements. this prohibits
|
|
things like FROM expressions being placed there directly.
|
|
[ticket:1622]
|
|
|
|
- `expression.null()` is fully understood the same way
|
|
None is when comparing an object/collection-referencing
|
|
attribute within query.filter(), filter_by(), etc.
|
|
[ticket:1415]
|
|
|
|
- added "make_transient()" helper function which transforms a
|
|
persistent/ detached instance into a transient one (i.e.
|
|
deletes the instance_key and removes from any session.)
|
|
[ticket:1052]
|
|
|
|
- the allow_null_pks flag on mapper() is deprecated, and
|
|
the feature is turned "on" by default. This means that
|
|
a row which has a non-null value for any of its primary key
|
|
columns will be considered an identity. The need for this
|
|
scenario typically only occurs when mapping to an outer join.
|
|
[ticket:1339]
|
|
|
|
- the mechanics of "backref" have been fully merged into the
|
|
finer grained "back_populates" system, and take place entirely
|
|
within the _generate_backref() method of RelationProperty. This
|
|
makes the initialization procedure of RelationProperty
|
|
simpler and allows easier propagation of settings (such as from
|
|
subclasses of RelationProperty) into the reverse reference.
|
|
The internal BackRef() is gone and backref() returns a plain
|
|
tuple that is understood by RelationProperty.
|
|
|
|
- The version_id_col feature on mapper() will raise a warning when
|
|
used with dialects that don't support "rowcount" adequately.
|
|
[ticket:1569]
|
|
|
|
- added "execution_options()" to Query, to so options can be
|
|
passed to the resulting statement. Currently only
|
|
Select-statements have these options, and the only option
|
|
used is "stream_results", and the only dialect which knows
|
|
"stream_results" is psycopg2.
|
|
|
|
- Query.yield_per() will set the "stream_results" statement
|
|
option automatically.
|
|
|
|
- Deprecated or removed:
|
|
* 'allow_null_pks' flag on mapper() is deprecated. It does
|
|
nothing now and the setting is "on" in all cases.
|
|
* 'transactional' flag on sessionmaker() and others is
|
|
removed. Use 'autocommit=True' to indicate 'transactional=False'.
|
|
* 'polymorphic_fetch' argument on mapper() is removed.
|
|
Loading can be controlled using the 'with_polymorphic'
|
|
option.
|
|
* 'select_table' argument on mapper() is removed. Use
|
|
'with_polymorphic=("*", <some selectable>)' for this
|
|
functionality.
|
|
* 'proxy' argument on synonym() is removed. This flag
|
|
did nothing throughout 0.5, as the "proxy generation"
|
|
behavior is now automatic.
|
|
* Passing a single list of elements to eagerload(),
|
|
eagerload_all(), contains_eager(), lazyload(),
|
|
defer(), and undefer() instead of multiple positional
|
|
*args is deprecated.
|
|
* Passing a single list of elements to query.order_by(),
|
|
query.group_by(), query.join(), or query.outerjoin()
|
|
instead of multiple positional *args is deprecated.
|
|
* query.iterate_instances() is removed. Use query.instances().
|
|
* Query.query_from_parent() is removed. Use the
|
|
sqlalchemy.orm.with_parent() function to produce a
|
|
"parent" clause, or alternatively query.with_parent().
|
|
* query._from_self() is removed, use query.from_self()
|
|
instead.
|
|
* the "comparator" argument to composite() is removed.
|
|
Use "comparator_factory".
|
|
* RelationProperty._get_join() is removed.
|
|
* the 'echo_uow' flag on Session is removed. Use
|
|
logging on the "sqlalchemy.orm.unitofwork" name.
|
|
* session.clear() is removed. use session.expunge_all().
|
|
* session.save(), session.update(), session.save_or_update()
|
|
are removed. Use session.add() and session.add_all().
|
|
* the "objects" flag on session.flush() remains deprecated.
|
|
* the "dont_load=True" flag on session.merge() is deprecated
|
|
in favor of "load=False".
|
|
* ScopedSession.mapper remains deprecated. See the
|
|
usage recipe at
|
|
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper
|
|
* passing an InstanceState (internal SQLAlchemy state object) to
|
|
attributes.init_collection() or attributes.get_history() is
|
|
deprecated. These functions are public API and normally
|
|
expect a regular mapped object instance.
|
|
* the 'engine' parameter to declarative_base() is removed.
|
|
Use the 'bind' keyword argument.
|
|
|
|
- sql
|
|
|
|
- the "autocommit" flag on select() and text() as well
|
|
as select().autocommit() are deprecated - now call
|
|
.execution_options(autocommit=True) on either of those
|
|
constructs, also available directly on Connection and orm.Query.
|
|
|
|
- the autoincrement flag on column now indicates the column
|
|
which should be linked to cursor.lastrowid, if that method
|
|
is used. See the API docs for details.
|
|
|
|
- an executemany() now requires that all bound parameter
|
|
sets require that all keys are present which are
|
|
present in the first bound parameter set. The structure
|
|
and behavior of an insert/update statement is very much
|
|
determined by the first parameter set, including which
|
|
defaults are going to fire off, and a minimum of
|
|
guesswork is performed with all the rest so that performance
|
|
is not impacted. For this reason defaults would otherwise
|
|
silently "fail" for missing parameters, so this is now guarded
|
|
against. [ticket:1566]
|
|
|
|
- returning() support is native to insert(), update(),
|
|
delete(). Implementations of varying levels of
|
|
functionality exist for Postgresql, Firebird, MSSQL and
|
|
Oracle. returning() can be called explicitly with column
|
|
expressions which are then returned in the resultset,
|
|
usually via fetchone() or first().
|
|
|
|
insert() constructs will also use RETURNING implicitly to
|
|
get newly generated primary key values, if the database
|
|
version in use supports it (a version number check is
|
|
performed). This occurs if no end-user returning() was
|
|
specified.
|
|
|
|
- union(), intersect(), except() and other "compound" types
|
|
of statements have more consistent behavior w.r.t.
|
|
parenthesizing. Each compound element embedded within
|
|
another will now be grouped with parenthesis - previously,
|
|
the first compound element in the list would not be grouped,
|
|
as SQLite doesn't like a statement to start with
|
|
parenthesis. However, Postgresql in particular has
|
|
precedence rules regarding INTERSECT, and it is
|
|
more consistent for parenthesis to be applied equally
|
|
to all sub-elements. So now, the workaround for SQLite
|
|
is also what the workaround for PG was previously -
|
|
when nesting compound elements, the first one usually needs
|
|
".alias().select()" called on it to wrap it inside
|
|
of a subquery. [ticket:1665]
|
|
|
|
- insert() and update() constructs can now embed bindparam()
|
|
objects using names that match the keys of columns. These
|
|
bind parameters will circumvent the usual route to those
|
|
keys showing up in the VALUES or SET clause of the generated
|
|
SQL. [ticket:1579]
|
|
|
|
- the Binary type now returns data as a Python string
|
|
(or a "bytes" type in Python 3), instead of the built-
|
|
in "buffer" type. This allows symmetric round trips
|
|
of binary data. [ticket:1524]
|
|
|
|
- Added a tuple_() construct, allows sets of expressions
|
|
to be compared to another set, typically with IN against
|
|
composite primary keys or similar. Also accepts an
|
|
IN with multiple columns. The "scalar select can
|
|
have only one column" error message is removed - will
|
|
rely upon the database to report problems with
|
|
col mismatch.
|
|
|
|
- User-defined "default" and "onupdate" callables which
|
|
accept a context should now call upon
|
|
"context.current_parameters" to get at the dictionary
|
|
of bind parameters currently being processed. This
|
|
dict is available in the same way regardless of
|
|
single-execute or executemany-style statement execution.
|
|
|
|
- multi-part schema names, i.e. with dots such as
|
|
"dbo.master", are now rendered in select() labels
|
|
with underscores for dots, i.e. "dbo_master_table_column".
|
|
This is a "friendly" label that behaves better
|
|
in result sets. [ticket:1428]
|
|
|
|
- removed needless "counter" behavior with select()
|
|
labelnames that match a column name in the table,
|
|
i.e. generates "tablename_id" for "id", instead of
|
|
"tablename_id_1" in an attempt to avoid naming
|
|
conflicts, when the table has a column actually
|
|
named "tablename_id" - this is because
|
|
the labeling logic is always applied to all columns
|
|
so a naming conflict will never occur.
|
|
|
|
- calling expr.in_([]), i.e. with an empty list, emits a warning
|
|
before issuing the usual "expr != expr" clause. The
|
|
"expr != expr" can be very expensive, and it's preferred
|
|
that the user not issue in_() if the list is empty,
|
|
instead simply not querying, or modifying the criterion
|
|
as appropriate for more complex situations.
|
|
[ticket:1628]
|
|
|
|
- Added "execution_options()" to select()/text(), which set the
|
|
default options for the Connection. See the note in "engines".
|
|
|
|
- Deprecated or removed:
|
|
* "scalar" flag on select() is removed, use
|
|
select.as_scalar().
|
|
* "shortname" attribute on bindparam() is removed.
|
|
* postgres_returning, firebird_returning flags on
|
|
insert(), update(), delete() are deprecated, use
|
|
the new returning() method.
|
|
* fold_equivalents flag on join is deprecated (will remain
|
|
until [ticket:1131] is implemented)
|
|
|
|
- engines
|
|
- transaction isolation level may be specified with
|
|
create_engine(... isolation_level="..."); available on
|
|
postgresql and sqlite. [ticket:443]
|
|
|
|
- Connection has execution_options(), generative method
|
|
which accepts keywords that affect how the statement
|
|
is executed w.r.t. the DBAPI. Currently supports
|
|
"stream_results", causes psycopg2 to use a server
|
|
side cursor for that statement, as well as
|
|
"autocommit", which is the new location for the "autocommit"
|
|
option from select() and text(). select() and
|
|
text() also have .execution_options() as well as
|
|
ORM Query().
|
|
|
|
- fixed the import for entrypoint-driven dialects to
|
|
not rely upon silly tb_info trick to determine import
|
|
error status. [ticket:1630]
|
|
|
|
- added first() method to ResultProxy, returns first row and
|
|
closes result set immediately.
|
|
|
|
- RowProxy objects are now pickleable, i.e. the object returned
|
|
by result.fetchone(), result.fetchall() etc.
|
|
|
|
- RowProxy no longer has a close() method, as the row no longer
|
|
maintains a reference to the parent. Call close() on
|
|
the parent ResultProxy instead, or use autoclose.
|
|
|
|
- ResultProxy internals have been overhauled to greatly reduce
|
|
method call counts when fetching columns. Can provide a large
|
|
speed improvement (up to more than 100%) when fetching large
|
|
result sets. The improvement is larger when fetching columns
|
|
that have no type-level processing applied and when using
|
|
results as tuples (instead of as dictionaries). Many
|
|
thanks to Elixir's Gaëtan de Menten for this dramatic
|
|
improvement ! [ticket:1586]
|
|
|
|
- Databases which rely upon postfetch of "last inserted id"
|
|
to get at a generated sequence value (i.e. MySQL, MS-SQL)
|
|
now work correctly when there is a composite primary key
|
|
where the "autoincrement" column is not the first primary
|
|
key column in the table.
|
|
|
|
- the last_inserted_ids() method has been renamed to the
|
|
descriptor "inserted_primary_key".
|
|
|
|
- setting echo=False on create_engine() now sets the loglevel
|
|
to WARN instead of NOTSET. This so that logging can be
|
|
disabled for a particular engine even if logging
|
|
for "sqlalchemy.engine" is enabled overall. Note that the
|
|
default setting of "echo" is `None`. [ticket:1554]
|
|
|
|
- ConnectionProxy now has wrapper methods for all transaction
|
|
lifecycle events, including begin(), rollback(), commit()
|
|
begin_nested(), begin_prepared(), prepare(), release_savepoint(),
|
|
etc.
|
|
|
|
- Connection pool logging now uses both INFO and DEBUG
|
|
log levels for logging. INFO is for major events such
|
|
as invalidated connections, DEBUG for all the acquire/return
|
|
logging. `echo_pool` can be False, None, True or "debug"
|
|
the same way as `echo` works.
|
|
|
|
- All pyodbc-dialects now support extra pyodbc-specific
|
|
kw arguments 'ansi', 'unicode_results', 'autocommit'.
|
|
[ticket:1621]
|
|
|
|
- the "threadlocal" engine has been rewritten and simplified
|
|
and now supports SAVEPOINT operations.
|
|
|
|
- deprecated or removed
|
|
* result.last_inserted_ids() is deprecated. Use
|
|
result.inserted_primary_key
|
|
* dialect.get_default_schema_name(connection) is now
|
|
public via dialect.default_schema_name.
|
|
* the "connection" argument from engine.transaction() and
|
|
engine.run_callable() is removed - Connection itself
|
|
now has those methods. All four methods accept
|
|
*args and **kwargs which are passed to the given callable,
|
|
as well as the operating connection.
|
|
|
|
- schema
|
|
- the `__contains__()` method of `MetaData` now accepts
|
|
strings or `Table` objects as arguments. If given
|
|
a `Table`, the argument is converted to `table.key` first,
|
|
i.e. "[schemaname.]<tablename>" [ticket:1541]
|
|
|
|
- deprecated MetaData.connect() and
|
|
ThreadLocalMetaData.connect() have been removed - send
|
|
the "bind" attribute to bind a metadata.
|
|
|
|
- deprecated metadata.table_iterator() method removed (use
|
|
sorted_tables)
|
|
|
|
- deprecated PassiveDefault - use DefaultClause.
|
|
|
|
- the "metadata" argument is removed from DefaultGenerator
|
|
and subclasses, but remains locally present on Sequence,
|
|
which is a standalone construct in DDL.
|
|
|
|
- Removed public mutability from Index and Constraint
|
|
objects:
|
|
- ForeignKeyConstraint.append_element()
|
|
- Index.append_column()
|
|
- UniqueConstraint.append_column()
|
|
- PrimaryKeyConstraint.add()
|
|
- PrimaryKeyConstraint.remove()
|
|
These should be constructed declaratively (i.e. in one
|
|
construction).
|
|
|
|
- The "start" and "increment" attributes on Sequence now
|
|
generate "START WITH" and "INCREMENT BY" by default,
|
|
on Oracle and Postgresql. Firebird doesn't support
|
|
these keywords right now. [ticket:1545]
|
|
|
|
- UniqueConstraint, Index, PrimaryKeyConstraint all accept
|
|
lists of column names or column objects as arguments.
|
|
|
|
- Other removed things:
|
|
- Table.key (no idea what this was for)
|
|
- Table.primary_key is not assignable - use
|
|
table.append_constraint(PrimaryKeyConstraint(...))
|
|
- Column.bind (get via column.table.bind)
|
|
- Column.metadata (get via column.table.metadata)
|
|
- Column.sequence (use column.default)
|
|
- ForeignKey(constraint=some_parent) (is now private _constraint)
|
|
|
|
- The use_alter flag on ForeignKey is now a shortcut option
|
|
for operations that can be hand-constructed using the
|
|
DDL() event system. A side effect of this refactor is
|
|
that ForeignKeyConstraint objects with use_alter=True
|
|
will *not* be emitted on SQLite, which does not support
|
|
ALTER for foreign keys.
|
|
|
|
- ForeignKey and ForeignKeyConstraint objects now correctly
|
|
copy() all their public keyword arguments. [ticket:1605]
|
|
|
|
- Reflection/Inspection
|
|
- Table reflection has been expanded and generalized into
|
|
a new API called "sqlalchemy.engine.reflection.Inspector".
|
|
The Inspector object provides fine-grained information about
|
|
a wide variety of schema information, with room for expansion,
|
|
including table names, column names, view definitions, sequences,
|
|
indexes, etc.
|
|
|
|
- Views are now reflectable as ordinary Table objects. The same
|
|
Table constructor is used, with the caveat that "effective"
|
|
primary and foreign key constraints aren't part of the reflection
|
|
results; these have to be specified explicitly if desired.
|
|
|
|
- The existing autoload=True system now uses Inspector underneath
|
|
so that each dialect need only return "raw" data about tables
|
|
and other objects - Inspector is the single place that information
|
|
is compiled into Table objects so that consistency is at a maximum.
|
|
|
|
- DDL
|
|
- the DDL system has been greatly expanded. the DDL() class
|
|
now extends the more generic DDLElement(), which forms the basis
|
|
of many new constructs:
|
|
|
|
- CreateTable()
|
|
- DropTable()
|
|
- AddConstraint()
|
|
- DropConstraint()
|
|
- CreateIndex()
|
|
- DropIndex()
|
|
- CreateSequence()
|
|
- DropSequence()
|
|
|
|
These support "on" and "execute-at()" just like plain DDL()
|
|
does. User-defined DDLElement subclasses can be created and
|
|
linked to a compiler using the sqlalchemy.ext.compiler extension.
|
|
|
|
- The signature of the "on" callable passed to DDL() and
|
|
DDLElement() is revised as follows:
|
|
|
|
"ddl" - the DDLElement object itself.
|
|
"event" - the string event name.
|
|
"target" - previously "schema_item", the Table or
|
|
MetaData object triggering the event.
|
|
"connection" - the Connection object in use for the operation.
|
|
**kw - keyword arguments. In the case of MetaData before/after
|
|
create/drop, the list of Table objects for which
|
|
CREATE/DROP DDL is to be issued is passed as the kw
|
|
argument "tables". This is necessary for metadata-level
|
|
DDL that is dependent on the presence of specific tables.
|
|
|
|
- the "schema_item" attribute of DDL has been renamed to
|
|
"target".
|
|
|
|
- dialect refactor
|
|
- Dialect modules are now broken into database dialects
|
|
plus DBAPI implementations. Connect URLs are now
|
|
preferred to be specified using dialect+driver://...,
|
|
i.e. "mysql+mysqldb://scott:tiger@localhost/test". See
|
|
the 0.6 documentation for examples.
|
|
|
|
- the setuptools entrypoint for external dialects is now
|
|
called "sqlalchemy.dialects".
|
|
|
|
- the "owner" keyword argument is removed from Table. Use
|
|
"schema" to represent any namespaces to be prepended to
|
|
the table name.
|
|
|
|
- server_version_info becomes a static attribute.
|
|
|
|
- dialects receive an initialize() event on initial
|
|
connection to determine connection properties.
|
|
|
|
- dialects receive a visit_pool event have an opportunity
|
|
to establish pool listeners.
|
|
|
|
- cached TypeEngine classes are cached per-dialect class
|
|
instead of per-dialect.
|
|
|
|
- new UserDefinedType should be used as a base class for
|
|
new types, which preserves the 0.5 behavior of
|
|
get_col_spec().
|
|
|
|
- The result_processor() method of all type classes now
|
|
accepts a second argument "coltype", which is the DBAPI
|
|
type argument from cursor.description. This argument
|
|
can help some types decide on the most efficient processing
|
|
of result values.
|
|
|
|
- Deprecated Dialect.get_params() removed.
|
|
|
|
- Dialect.get_rowcount() has been renamed to a descriptor
|
|
"rowcount", and calls cursor.rowcount directly. Dialects
|
|
which need to hardwire a rowcount in for certain calls
|
|
should override the method to provide different behavior.
|
|
|
|
- DefaultRunner and subclasses have been removed. The job
|
|
of this object has been simplified and moved into
|
|
ExecutionContext. Dialects which support sequences should
|
|
add a `fire_sequence()` method to their execution context
|
|
implementation. [ticket:1566]
|
|
|
|
- Functions and operators generated by the compiler now use
|
|
(almost) regular dispatch functions of the form
|
|
"visit_<opname>" and "visit_<funcname>_fn" to provide
|
|
customed processing. This replaces the need to copy the
|
|
"functions" and "operators" dictionaries in compiler
|
|
subclasses with straightforward visitor methods, and also
|
|
allows compiler subclasses complete control over
|
|
rendering, as the full _Function or _BinaryExpression
|
|
object is passed in.
|
|
|
|
- postgresql
|
|
- New dialects: pg8000, zxjdbc, and pypostgresql
|
|
on py3k.
|
|
|
|
- The "postgres" dialect is now named "postgresql" !
|
|
Connection strings look like:
|
|
|
|
postgresql://scott:tiger@localhost/test
|
|
postgresql+pg8000://scott:tiger@localhost/test
|
|
|
|
The "postgres" name remains for backwards compatiblity
|
|
in the following ways:
|
|
|
|
- There is a "postgres.py" dummy dialect which
|
|
allows old URLs to work, i.e.
|
|
postgres://scott:tiger@localhost/test
|
|
|
|
- The "postgres" name can be imported from the old
|
|
"databases" module, i.e. "from
|
|
sqlalchemy.databases import postgres" as well as
|
|
"dialects", "from sqlalchemy.dialects.postgres
|
|
import base as pg", will send a deprecation
|
|
warning.
|
|
|
|
- Special expression arguments are now named
|
|
"postgresql_returning" and "postgresql_where", but
|
|
the older "postgres_returning" and
|
|
"postgres_where" names still work with a
|
|
deprecation warning.
|
|
|
|
- "postgresql_where" now accepts SQL expressions which
|
|
can also include literals, which will be quoted as needed.
|
|
|
|
- The psycopg2 dialect now uses psycopg2's "unicode extension"
|
|
on all new connections, which allows all String/Text/etc.
|
|
types to skip the need to post-process bytestrings into
|
|
unicode (an expensive step due to its volume). Other
|
|
dialects which return unicode natively (pg8000, zxjdbc)
|
|
also skip unicode post-processing.
|
|
|
|
- Added new ENUM type, which exists as a schema-level
|
|
construct and extends the generic Enum type. Automatically
|
|
associates itself with tables and their parent metadata
|
|
to issue the appropriate CREATE TYPE/DROP TYPE
|
|
commands as needed, supports unicode labels, supports
|
|
reflection. [ticket:1511]
|
|
|
|
- INTERVAL supports an optional "precision" argument
|
|
corresponding to the argument that PG accepts.
|
|
|
|
- using new dialect.initialize() feature to set up
|
|
version-dependent behavior.
|
|
|
|
- somewhat better support for % signs in table/column names;
|
|
psycopg2 can't handle a bind parameter name of
|
|
%(foobar)s however and SQLA doesn't want to add overhead
|
|
just to treat that one non-existent use case.
|
|
[ticket:1279]
|
|
|
|
- Inserting NULL into a primary key + foreign key column
|
|
will allow the "not null constraint" error to raise,
|
|
not an attempt to execute a nonexistent "col_id_seq"
|
|
sequence. [ticket:1516]
|
|
|
|
- autoincrement SELECT statements, i.e. those which
|
|
select from a procedure that modifies rows, now work
|
|
with server-side cursor mode (the named cursor isn't
|
|
used for such statements.)
|
|
|
|
- postgresql dialect can properly detect pg "devel" version
|
|
strings, i.e. "8.5devel" [ticket:1636]
|
|
|
|
- The psycopg2 now respects the statement option
|
|
"stream_results". This option overrides the connection setting
|
|
"server_side_cursors". If true, server side cursors will be
|
|
used for the statement. If false, they will not be used, even
|
|
if "server_side_cursors" is true on the
|
|
connection. [ticket:1619]
|
|
|
|
- mysql
|
|
- New dialects: oursql, a new native dialect,
|
|
MySQL Connector/Python, a native Python port of MySQLdb,
|
|
and of course zxjdbc on Jython.
|
|
|
|
- VARCHAR/NVARCHAR will not render without a length, raises
|
|
an error before passing to MySQL. Doesn't impact
|
|
CAST since VARCHAR is not allowed in MySQL CAST anyway,
|
|
the dialect renders CHAR/NCHAR in those cases.
|
|
|
|
- all the _detect_XXX() functions now run once underneath
|
|
dialect.initialize()
|
|
|
|
- somewhat better support for % signs in table/column names;
|
|
MySQLdb can't handle % signs in SQL when executemany() is used,
|
|
and SQLA doesn't want to add overhead just to treat that one
|
|
non-existent use case. [ticket:1279]
|
|
|
|
- the BINARY and MSBinary types now generate "BINARY" in all
|
|
cases. Omitting the "length" parameter will generate
|
|
"BINARY" with no length. Use BLOB to generate an unlengthed
|
|
binary column.
|
|
|
|
- the "quoting='quoted'" argument to MSEnum/ENUM is deprecated.
|
|
It's best to rely upon the automatic quoting.
|
|
|
|
- ENUM now subclasses the new generic Enum type, and also handles
|
|
unicode values implicitly, if the given labelnames are unicode
|
|
objects.
|
|
|
|
- a column of type TIMESTAMP now defaults to NULL if
|
|
"nullable=False" is not passed to Column(), and no default
|
|
is present. This is now consistent with all other types,
|
|
and in the case of TIMESTAMP explictly renders "NULL"
|
|
due to MySQL's "switching" of default nullability
|
|
for TIMESTAMP columns. [ticket:1539]
|
|
|
|
- oracle
|
|
- unit tests pass 100% with cx_oracle !
|
|
|
|
- support for cx_Oracle's "native unicode" mode which does
|
|
not require NLS_LANG to be set. Use the latest 5.0.2 or
|
|
later of cx_oracle.
|
|
|
|
- an NCLOB type is added to the base types.
|
|
|
|
- use_ansi=False won't leak into the FROM/WHERE clause of
|
|
a statement that's selecting from a subquery that also
|
|
uses JOIN/OUTERJOIN.
|
|
|
|
- added native INTERVAL type to the dialect. This supports
|
|
only the DAY TO SECOND interval type so far due to lack
|
|
of support in cx_oracle for YEAR TO MONTH. [ticket:1467]
|
|
|
|
- usage of the CHAR type results in cx_oracle's
|
|
FIXED_CHAR dbapi type being bound to statements.
|
|
|
|
- the Oracle dialect now features NUMBER which intends
|
|
to act justlike Oracle's NUMBER type. It is the primary
|
|
numeric type returned by table reflection and attempts
|
|
to return Decimal()/float/int based on the precision/scale
|
|
parameters. [ticket:885]
|
|
|
|
- func.char_length is a generic function for LENGTH
|
|
|
|
- ForeignKey() which includes onupdate=<value> will emit a
|
|
warning, not emit ON UPDATE CASCADE which is unsupported
|
|
by oracle
|
|
|
|
- the keys() method of RowProxy() now returns the result
|
|
column names *normalized* to be SQLAlchemy case
|
|
insensitive names. This means they will be lower case for
|
|
case insensitive names, whereas the DBAPI would normally
|
|
return them as UPPERCASE names. This allows row keys() to
|
|
be compatible with further SQLAlchemy operations.
|
|
|
|
- using new dialect.initialize() feature to set up
|
|
version-dependent behavior.
|
|
|
|
- using types.BigInteger with Oracle will generate
|
|
NUMBER(19) [ticket:1125]
|
|
|
|
- "case sensitivity" feature will detect an all-lowercase
|
|
case-sensitive column name during reflect and add
|
|
"quote=True" to the generated Column, so that proper
|
|
quoting is maintained.
|
|
|
|
- firebird
|
|
- the keys() method of RowProxy() now returns the result
|
|
column names *normalized* to be SQLAlchemy case
|
|
insensitive names. This means they will be lower case for
|
|
case insensitive names, whereas the DBAPI would normally
|
|
return them as UPPERCASE names. This allows row keys() to
|
|
be compatible with further SQLAlchemy operations.
|
|
|
|
- using new dialect.initialize() feature to set up
|
|
version-dependent behavior.
|
|
|
|
- "case sensitivity" feature will detect an all-lowercase
|
|
case-sensitive column name during reflect and add
|
|
"quote=True" to the generated Column, so that proper
|
|
quoting is maintained.
|
|
|
|
- mssql
|
|
- MSSQL + Pyodbc + FreeTDS now works for the most part,
|
|
with possible exceptions regarding binary data as well as
|
|
unicode schema identifiers.
|
|
- the "has_window_funcs" flag is removed. LIMIT/OFFSET
|
|
usage will use ROW NUMBER as always, and if on an older
|
|
version of SQL Server, the operation fails. The behavior
|
|
is exactly the same except the error is raised by SQL
|
|
server instead of the dialect, and no flag setting is
|
|
required to enable it.
|
|
- the "auto_identity_insert" flag is removed. This feature
|
|
always takes effect when an INSERT statement overrides a
|
|
column that is known to have a sequence on it. As with
|
|
"has_window_funcs", if the underlying driver doesn't
|
|
support this, then you can't do this operation in any
|
|
case, so there's no point in having a flag.
|
|
- using new dialect.initialize() feature to set up
|
|
version-dependent behavior.
|
|
- removed references to sequence which is no longer used.
|
|
implicit identities in mssql work the same as implicit
|
|
sequences on any other dialects. Explicit sequences are
|
|
enabled through the use of "default=Sequence()". See
|
|
the MSSQL dialect documentation for more information.
|
|
|
|
- sqlite
|
|
- DATE, TIME and DATETIME types can now take optional storage_format
|
|
and regexp argument. storage_format can be used to store those types
|
|
using a custom string format. regexp allows to use a custom regular
|
|
expression to match string values from the database.
|
|
- Time and DateTime types now use by a default a stricter regular
|
|
expression to match strings from the database. Use the regexp
|
|
argument if you are using data stored in a legacy format.
|
|
- __legacy_microseconds__ on SQLite Time and DateTime types is not
|
|
supported anymore. You should use the storage_format argument
|
|
instead.
|
|
- Date, Time and DateTime types are now stricter in what they accept as
|
|
bind parameters: Date type only accepts date objects (and datetime
|
|
ones, because they inherit from date), Time only accepts time
|
|
objects, and DateTime only accepts date and datetime objects.
|
|
- Table() supports a keyword argument "sqlite_autoincrement", which
|
|
applies the SQLite keyword "AUTOINCREMENT" to the single integer
|
|
primary key column when generating DDL. Will prevent generation of
|
|
a separate PRIMARY KEY constraint. [ticket:1016]
|
|
|
|
- new dialects
|
|
- postgresql+pg8000
|
|
- postgresql+pypostgresql (partial)
|
|
- postgresql+zxjdbc
|
|
- mysql+pyodbc
|
|
- mysql+zxjdbc
|
|
|
|
- types
|
|
- The construction of types within dialects has been totally
|
|
overhauled. Dialects now define publically available types
|
|
as UPPERCASE names exclusively, and internal implementation
|
|
types using underscore identifiers (i.e. are private).
|
|
The system by which types are expressed in SQL and DDL
|
|
has been moved to the compiler system. This has the
|
|
effect that there are much fewer type objects within
|
|
most dialects. A detailed document on this architecture
|
|
for dialect authors is in
|
|
lib/sqlalchemy/dialects/type_migration_guidelines.txt .
|
|
|
|
- Types no longer make any guesses as to default
|
|
parameters. In particular, Numeric, Float, NUMERIC,
|
|
FLOAT, DECIMAL don't generate any length or scale unless
|
|
specified.
|
|
|
|
- types.Binary is renamed to types.LargeBinary, it only
|
|
produces BLOB, BYTEA, or a similar "long binary" type.
|
|
New base BINARY and VARBINARY
|
|
types have been added to access these MySQL/MS-SQL specific
|
|
types in an agnostic way [ticket:1664].
|
|
|
|
- String/Text/Unicode types now skip the unicode() check
|
|
on each result column value if the dialect has
|
|
detected the DBAPI as returning Python unicode objects
|
|
natively. This check is issued on first connect
|
|
using "SELECT CAST 'some text' AS VARCHAR(10)" or
|
|
equivalent, then checking if the returned object
|
|
is a Python unicode. This allows vast performance
|
|
increases for native-unicode DBAPIs, including
|
|
pysqlite/sqlite3, psycopg2, and pg8000.
|
|
|
|
- Most types result processors have been checked for possible speed
|
|
improvements. Specifically, the following generic types have been
|
|
optimized, resulting in varying speed improvements:
|
|
Unicode, PickleType, Interval, TypeDecorator, Binary.
|
|
Also the following dbapi-specific implementations have been improved:
|
|
Time, Date and DateTime on Sqlite, ARRAY on Postgresql,
|
|
Time on MySQL, Numeric(as_decimal=False) on MySQL, oursql and
|
|
pypostgresql, DateTime on cx_oracle and LOB-based types on cx_oracle.
|
|
|
|
- Reflection of types now returns the exact UPPERCASE
|
|
type within types.py, or the UPPERCASE type within
|
|
the dialect itself if the type is not a standard SQL
|
|
type. This means reflection now returns more accurate
|
|
information about reflected types.
|
|
|
|
- Added a new Enum generic type. Enum is a schema-aware object
|
|
to support databases which require specific DDL in order to
|
|
use enum or equivalent; in the case of PG it handles the
|
|
details of `CREATE TYPE`, and on other databases without
|
|
native enum support will by generate VARCHAR + an inline CHECK
|
|
constraint to enforce the enum.
|
|
[ticket:1109] [ticket:1511]
|
|
|
|
- The Interval type includes a "native" flag which controls
|
|
if native INTERVAL types (postgresql + oracle) are selected
|
|
if available, or not. "day_precision" and "second_precision"
|
|
arguments are also added which propagate as appropriately
|
|
to these native types. Related to [ticket:1467].
|
|
|
|
- The Boolean type, when used on a backend that doesn't
|
|
have native boolean support, will generate a CHECK
|
|
constraint "col IN (0, 1)" along with the int/smallint-
|
|
based column type. This can be switched off if
|
|
desired with create_constraint=False.
|
|
Note that MySQL has no native boolean *or* CHECK constraint
|
|
support so this feature isn't available on that platform.
|
|
[ticket:1589]
|
|
|
|
- PickleType now uses == for comparison of values when
|
|
mutable=True, unless the "comparator" argument with a
|
|
comparsion function is specified to the type. Objects
|
|
being pickled will be compared based on identity (which
|
|
defeats the purpose of mutable=True) if __eq__() is not
|
|
overridden or a comparison function is not provided.
|
|
|
|
- The default "precision" and "scale" arguments of Numeric
|
|
and Float have been removed and now default to None.
|
|
NUMERIC and FLOAT will be rendered with no numeric
|
|
arguments by default unless these values are provided.
|
|
|
|
- AbstractType.get_search_list() is removed - the games
|
|
that was used for are no longer necessary.
|
|
|
|
- Added a generic BigInteger type, compiles to
|
|
BIGINT or NUMBER(19). [ticket:1125]
|
|
|
|
-ext
|
|
- sqlsoup has been overhauled to explicitly support an 0.5 style
|
|
session, using autocommit=False, autoflush=True. Default
|
|
behavior of SQLSoup now requires the usual usage of commit()
|
|
and rollback(), which have been added to its interface. An
|
|
explcit Session or scoped_session can be passed to the
|
|
constructor, allowing these arguments to be overridden.
|
|
|
|
- sqlsoup db.<sometable>.update() and delete() now call
|
|
query(cls).update() and delete(), respectively.
|
|
|
|
- sqlsoup now has execute() and connection(), which call upon
|
|
the Session methods of those names, ensuring that the bind is
|
|
in terms of the SqlSoup object's bind.
|
|
|
|
- sqlsoup objects no longer have the 'query' attribute - it's
|
|
not needed for sqlsoup's usage paradigm and it gets in the
|
|
way of a column that is actually named 'query'.
|
|
|
|
- The signature of the proxy_factory callable passed to
|
|
association_proxy is now (lazy_collection, creator,
|
|
value_attr, association_proxy), adding a fourth argument
|
|
that is the parent AssociationProxy argument. Allows
|
|
serializability and subclassing of the built in collections.
|
|
[ticket:1259]
|
|
|
|
- association_proxy now has basic comparator methods .any(),
|
|
.has(), .contains(), ==, !=, thanks to Scott Torborg.
|
|
[ticket:1372]
|
|
|
|
- examples
|
|
- The "query_cache" examples have been removed, and are replaced
|
|
with a fully comprehensive approach that combines the usage of
|
|
Beaker with SQLAlchemy. New query options are used to indicate
|
|
the caching characteristics of a particular Query, which
|
|
can also be invoked deep within an object graph when lazily
|
|
loading related objects. See /examples/beaker_caching/README.
|
|
|
|
0.5.9
|
|
=====
|
|
- sql
|
|
- Fixed erroneous self_group() call in expression package.
|
|
[ticket:1661]
|
|
|
|
0.5.8
|
|
=====
|
|
- sql
|
|
- The copy() method on Column now supports uninitialized,
|
|
unnamed Column objects. This allows easy creation of
|
|
declarative helpers which place common columns on multiple
|
|
subclasses.
|
|
|
|
- Default generators like Sequence() translate correctly
|
|
across a copy() operation.
|
|
|
|
- Sequence() and other DefaultGenerator objects are accepted
|
|
as the value for the "default" and "onupdate" keyword
|
|
arguments of Column, in addition to being accepted
|
|
positionally.
|
|
|
|
- Fixed a column arithmetic bug that affected column
|
|
correspondence for cloned selectables which contain
|
|
free-standing column expressions. This bug is
|
|
generally only noticeable when exercising newer
|
|
ORM behavior only availble in 0.6 via [ticket:1568],
|
|
but is more correct at the SQL expression level
|
|
as well. [ticket:1617]
|
|
|
|
- postgresql
|
|
- The extract() function, which was slightly improved in
|
|
0.5.7, needed a lot more work to generate the correct
|
|
typecast (the typecasts appear to be necessary in PG's
|
|
EXTRACT quite a lot of the time). The typecast is
|
|
now generated using a rule dictionary based
|
|
on PG's documentation for date/time/interval arithmetic.
|
|
It also accepts text() constructs again, which was broken
|
|
in 0.5.7. [ticket:1647]
|
|
|
|
- firebird
|
|
- Recognize more errors as disconnections. [ticket:1646]
|
|
|
|
0.5.7
|
|
=====
|
|
- orm
|
|
- contains_eager() now works with the automatically
|
|
generated subquery that results when you say
|
|
"query(Parent).join(Parent.somejoinedsubclass)", i.e.
|
|
when Parent joins to a joined-table-inheritance subclass.
|
|
Previously contains_eager() would erroneously add the
|
|
subclass table to the query separately producing a
|
|
cartesian product. An example is in the ticket
|
|
description. [ticket:1543]
|
|
|
|
- query.options() now only propagate to loaded objects
|
|
for potential further sub-loads only for options where
|
|
such behavior is relevant, keeping
|
|
various unserializable options like those generated
|
|
by contains_eager() out of individual instance states.
|
|
[ticket:1553]
|
|
|
|
- Session.execute() now locates table- and
|
|
mapper-specific binds based on a passed
|
|
in expression which is an insert()/update()/delete()
|
|
construct. [ticket:1054]
|
|
|
|
- Session.merge() now properly overwrites a many-to-one or
|
|
uselist=False attribute to None if the attribute
|
|
is also None in the given object to be merged.
|
|
|
|
- Fixed a needless select which would occur when merging
|
|
transient objects that contained a null primary key
|
|
identifier. [ticket:1618]
|
|
|
|
- Mutable collection passed to the "extension" attribute
|
|
of relation(), column_property() etc. will not be mutated
|
|
or shared among multiple instrumentation calls, preventing
|
|
duplicate extensions, such as backref populators,
|
|
from being inserted into the list.
|
|
[ticket:1585]
|
|
|
|
- Fixed the call to get_committed_value() on CompositeProperty.
|
|
[ticket:1504]
|
|
|
|
- Fixed bug where Query would crash if a join() with no clear
|
|
"left" side were called when a non-mapped column entity
|
|
appeared in the columns list. [ticket:1602]
|
|
|
|
- Fixed bug whereby composite columns wouldn't load properly
|
|
when configured on a joined-table subclass, introduced in
|
|
version 0.5.6 as a result of the fix for [ticket:1480].
|
|
[ticket:1616] thx to Scott Torborg.
|
|
|
|
- The "use get" behavior of many-to-one relations, i.e. that a
|
|
lazy load will fallback to the possibly cached query.get()
|
|
value, now works across join conditions where the two compared
|
|
types are not exactly the same class, but share the same
|
|
"affinity" - i.e. Integer and SmallInteger. Also allows
|
|
combinations of reflected and non-reflected types to work
|
|
with 0.5 style type reflection, such as PGText/Text (note 0.6
|
|
reflects types as their generic versions). [ticket:1556]
|
|
|
|
- Fixed bug in query.update() when passing Cls.attribute
|
|
as keys in the value dict and using synchronize_session='expire'
|
|
('fetch' in 0.6). [ticket:1436]
|
|
|
|
- sql
|
|
- Fixed bug in two-phase transaction whereby commit() method
|
|
didn't set the full state which allows subsequent close()
|
|
call to succeed. [ticket:1603]
|
|
|
|
- Fixed the "numeric" paramstyle, which apparently is the
|
|
default paramstyle used by Informixdb.
|
|
|
|
- Repeat expressions in the columns clause of a select
|
|
are deduped based on the identity of each clause element,
|
|
not the actual string. This allows positional
|
|
elements to render correctly even if they all render
|
|
identically, such as "qmark" style bind parameters.
|
|
[ticket:1574]
|
|
|
|
- The cursor associated with connection pool connections
|
|
(i.e. _CursorFairy) now proxies `__iter__()` to the
|
|
underlying cursor correctly. [ticket:1632]
|
|
|
|
- types now support an "affinity comparison" operation, i.e.
|
|
that an Integer/SmallInteger are "compatible", or
|
|
a Text/String, PickleType/Binary, etc. Part of
|
|
[ticket:1556].
|
|
|
|
- Fixed bug preventing alias() of an alias() from being
|
|
cloned or adapted (occurs frequently in ORM operations).
|
|
[ticket:1641]
|
|
|
|
- sqlite
|
|
- sqlite dialect properly generates CREATE INDEX for a table
|
|
that is in an alternate schema. [ticket:1439]
|
|
|
|
- postgresql
|
|
- Added support for reflecting the DOUBLE PRECISION type,
|
|
via a new postgres.PGDoublePrecision object.
|
|
This is postgresql.DOUBLE_PRECISION in 0.6.
|
|
[ticket:1085]
|
|
|
|
- Added support for reflecting the INTERVAL YEAR TO MONTH
|
|
and INTERVAL DAY TO SECOND syntaxes of the INTERVAL
|
|
type. [ticket:460]
|
|
|
|
- Corrected the "has_sequence" query to take current schema,
|
|
or explicit sequence-stated schema, into account.
|
|
[ticket:1576]
|
|
|
|
- Fixed the behavior of extract() to apply operator
|
|
precedence rules to the "::" operator when applying
|
|
the "timestamp" cast - ensures proper parenthesization.
|
|
[ticket:1611]
|
|
|
|
- mssql
|
|
- Changed the name of TrustedConnection to
|
|
Trusted_Connection when constructing pyodbc connect
|
|
arguments [ticket:1561]
|
|
|
|
- oracle
|
|
- The "table_names" dialect function, used by MetaData
|
|
.reflect(), omits "index overflow tables", a system
|
|
table generated by Oracle when "index only tables"
|
|
with overflow are used. These tables aren't accessible
|
|
via SQL and can't be reflected. [ticket:1637]
|
|
|
|
- ext
|
|
- A column can be added to a joined-table declarative
|
|
superclass after the class has been constructed
|
|
(i.e. via class-level attribute assignment), and
|
|
the column will be propagated down to
|
|
subclasses. [ticket:1570] This is the reverse
|
|
situation as that of [ticket:1523], fixed in 0.5.6.
|
|
|
|
- Fixed a slight inaccuracy in the sharding example.
|
|
Comparing equivalence of columns in the ORM is best
|
|
accomplished using col1.shares_lineage(col2).
|
|
[ticket:1491]
|
|
|
|
- Removed unused `load()` method from ShardedQuery.
|
|
[ticket:1606]
|
|
|
|
0.5.6
|
|
=====
|
|
- orm
|
|
- Fixed bug whereby inheritance discriminator part of a
|
|
composite primary key would fail on updates.
|
|
Continuation of [ticket:1300].
|
|
|
|
- Fixed bug which disallowed one side of a many-to-many
|
|
bidirectional reference to declare itself as "viewonly"
|
|
[ticket:1507]
|
|
|
|
- Added an assertion that prevents a @validates function
|
|
or other AttributeExtension from loading an unloaded
|
|
collection such that internal state may be corrupted.
|
|
[ticket:1526]
|
|
|
|
- Fixed bug which prevented two entities from mutually
|
|
replacing each other's primary key values within a single
|
|
flush() for some orderings of operations. [ticket:1519]
|
|
|
|
- Fixed an obscure issue whereby a joined-table subclass
|
|
with a self-referential eager load on the base class
|
|
would populate the related object's "subclass" table with
|
|
data from the "subclass" table of the parent.
|
|
[ticket:1485]
|
|
|
|
- relations() now have greater ability to be "overridden",
|
|
meaning a subclass that explicitly specifies a relation()
|
|
overriding that of the parent class will be honored
|
|
during a flush. This is currently to support
|
|
many-to-many relations from concrete inheritance setups.
|
|
Outside of that use case, YMMV. [ticket:1477]
|
|
|
|
- Squeezed a few more unnecessary "lazy loads" out of
|
|
relation(). When a collection is mutated, many-to-one
|
|
backrefs on the other side will not fire off to load
|
|
the "old" value, unless "single_parent=True" is set.
|
|
A direct assignment of a many-to-one still loads
|
|
the "old" value in order to update backref collections
|
|
on that value, which may be present in the session
|
|
already, thus maintaining the 0.5 behavioral contract.
|
|
[ticket:1483]
|
|
|
|
- Fixed bug whereby a load/refresh of joined table
|
|
inheritance attributes which were based on
|
|
column_property() or similar would fail to evaluate.
|
|
[ticket:1480]
|
|
|
|
- Improved support for MapperProperty objects overriding
|
|
that of an inherited mapper for non-concrete
|
|
inheritance setups - attribute extensions won't randomly
|
|
collide with each other. [ticket:1488]
|
|
|
|
- UPDATE and DELETE do not support ORDER BY, LIMIT, OFFSET,
|
|
etc. in standard SQL. Query.update() and Query.delete()
|
|
now raise an exception if any of limit(), offset(),
|
|
order_by(), group_by(), or distinct() have been
|
|
called. [ticket:1487]
|
|
|
|
- Added AttributeExtension to sqlalchemy.orm.__all__
|
|
|
|
- Improved error message when query() is called with
|
|
a non-SQL /entity expression. [ticket:1476]
|
|
|
|
- Using False or 0 as a polymorphic discriminator now
|
|
works on the base class as well as a subclass.
|
|
[ticket:1440]
|
|
|
|
- Added enable_assertions(False) to Query which disables
|
|
the usual assertions for expected state - used
|
|
by Query subclasses to engineer custom state.
|
|
[ticket:1424]. See
|
|
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery
|
|
for an example.
|
|
|
|
- Fixed recursion issue which occured if a mapped object's
|
|
`__len__()` or `__nonzero__()` method resulted in state
|
|
changes. [ticket:1501]
|
|
|
|
- Fixed incorrect exception raise in
|
|
Weak/StrongIdentityMap.add()
|
|
[ticket:1506]
|
|
|
|
- Fixed the error message for "could not find a FROM clause"
|
|
in query.join() which would fail to issue correctly
|
|
if the query was against a pure SQL construct.
|
|
[ticket:1522]
|
|
|
|
- Fixed a somewhat hypothetical issue which would result
|
|
in the wrong primary key being calculated for a mapper
|
|
using the old polymorphic_union function - but this
|
|
is old stuff. [ticket:1486]
|
|
|
|
- sql
|
|
- Fixed column.copy() to copy defaults and onupdates.
|
|
[ticket:1373]
|
|
|
|
- Fixed a bug in extract() introduced in 0.5.4 whereby
|
|
the string "field" argument was getting treated as a
|
|
ClauseElement, causing various errors within more
|
|
complex SQL transformations.
|
|
|
|
- Unary expressions such as DISTINCT propagate their
|
|
type handling to result sets, allowing conversions like
|
|
unicode and such to take place. [ticket:1420]
|
|
|
|
- Fixed bug in Table and Column whereby passing empty
|
|
dict for "info" argument would raise an exception.
|
|
[ticket:1482]
|
|
|
|
- oracle
|
|
- Backported 0.6 fix for Oracle alias names not getting
|
|
truncated. [ticket:1309]
|
|
|
|
- ext
|
|
- The collection proxies produced by associationproxy are now
|
|
pickleable. A user-defined proxy_factory however
|
|
is still not pickleable unless it defines __getstate__
|
|
and __setstate__. [ticket:1446]
|
|
|
|
- Declarative will raise an informative exception if
|
|
__table_args__ is passed as a tuple with no dict argument.
|
|
Improved documentation. [ticket:1468]
|
|
|
|
- Table objects declared in the MetaData can now be used
|
|
in string expressions sent to primaryjoin/secondaryjoin/
|
|
secondary - the name is pulled from the MetaData of the
|
|
declarative base. [ticket:1527]
|
|
|
|
- A column can be added to a joined-table subclass after
|
|
the class has been constructed (i.e. via class-level
|
|
attribute assignment). The column is added to the underlying
|
|
Table as always, but now the mapper will rebuild its
|
|
"join" to include the new column, instead of raising
|
|
an error about "no such column, use column_property()
|
|
instead". [ticket:1523]
|
|
|
|
- test
|
|
- Added examples into the test suite so they get exercised
|
|
regularly and cleaned up a couple deprecation warnings.
|
|
|
|
|
|
0.5.5
|
|
=======
|
|
- general
|
|
- unit tests have been migrated from unittest to nose. See
|
|
README.unittests for information on how to run the tests.
|
|
[ticket:970]
|
|
|
|
- orm
|
|
- The "foreign_keys" argument of relation() will now propagate
|
|
automatically to the backref in the same way that primaryjoin
|
|
and secondaryjoin do. For the extremely rare use case where
|
|
the backref of a relation() has intentionally different
|
|
"foreign_keys" configured, both sides now need to be
|
|
configured explicity (if they do in fact require this setting,
|
|
see the next note...).
|
|
|
|
- ...the only known (and really, really rare) use case where a
|
|
different foreign_keys setting was used on the
|
|
forwards/backwards side, a composite foreign key that
|
|
partially points to its own columns, has been enhanced such
|
|
that the fk->itself aspect of the relation won't be used to
|
|
determine relation direction.
|
|
|
|
- Session.mapper is now *deprecated*.
|
|
|
|
Call session.add() if you'd like a free-standing object to be
|
|
part of your session. Otherwise, a DIY version of
|
|
Session.mapper is now documented at
|
|
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper
|
|
The method will remain deprecated throughout 0.6.
|
|
|
|
- Fixed Query being able to join() from individual columns of a
|
|
joined-table subclass entity, i.e. query(SubClass.foo,
|
|
SubcClass.bar).join(<anything>). In most cases, an error
|
|
"Could not find a FROM clause to join from" would be
|
|
raised. In a few others, the result would be returned in terms
|
|
of the base class rather than the subclass - so applications
|
|
which relied on this erroneous result need to be
|
|
adjusted. [ticket:1431]
|
|
|
|
- Fixed a bug involving contains_eager(), which would apply
|
|
itself to a secondary (i.e. lazy) load in a particular rare
|
|
case, producing cartesian products. improved the targeting of
|
|
query.options() on secondary loads overall [ticket:1461].
|
|
|
|
- Fixed bug introduced in 0.5.4 whereby Composite types fail
|
|
when default-holding columns are flushed.
|
|
|
|
- Fixed another 0.5.4 bug whereby mutable attributes
|
|
(i.e. PickleType) wouldn't be deserialized correctly when the
|
|
whole object was serialized. [ticket:1426]
|
|
|
|
- Fixed bug whereby session.is_modified() would raise an
|
|
exception if any synonyms were in use.
|
|
|
|
- Fixed potential memory leak whereby previously pickled objects
|
|
placed back in a session would not be fully garbage collected
|
|
unless the Session were explicitly closed out.
|
|
|
|
- Fixed bug whereby list-based attributes, like pickletype and
|
|
PGArray, failed to be merged() properly.
|
|
|
|
- Repaired non-working attributes.set_committed_value function.
|
|
|
|
- Trimmed the pickle format for InstanceState which should
|
|
further reduce the memory footprint of pickled instances. The
|
|
format should be backwards compatible with that of 0.5.4 and
|
|
previous.
|
|
|
|
- sqlalchemy.orm.join and sqlalchemy.orm.outerjoin are now
|
|
added to __all__ in sqlalchemy.orm.*. [ticket:1463]
|
|
|
|
- Fixed bug where Query exception raise would fail when
|
|
a too-short composite primary key value were passed to
|
|
get(). [ticket:1458]
|
|
|
|
- sql
|
|
- Removed an obscure feature of execute() (including connection,
|
|
engine, Session) whereby a bindparam() construct can be sent
|
|
as a key to the params dictionary. This usage is undocumented
|
|
and is at the core of an issue whereby the bindparam() object
|
|
created implicitly by a text() construct may have the same
|
|
hash value as a string placed in the params dictionary and may
|
|
result in an inappropriate match when computing the final bind
|
|
parameters. Internal checks for this condition would add
|
|
significant latency to the critical task of parameter
|
|
rendering, so the behavior is removed. This is a backwards
|
|
incompatible change for any application that may have been
|
|
using this feature, however the feature has never been
|
|
documented.
|
|
|
|
- engine/pool
|
|
- Implemented recreate() for StaticPool.
|
|
|
|
|
|
0.5.4p2
|
|
=======
|
|
|
|
- sql
|
|
- Repaired the printing of SQL exceptions which are not
|
|
based on parameters or are not executemany() style.
|
|
|
|
- postgresql
|
|
- Deprecated the hardcoded TIMESTAMP function, which when
|
|
used as func.TIMESTAMP(value) would render "TIMESTAMP value".
|
|
This breaks on some platforms as PostgreSQL doesn't allow
|
|
bind parameters to be used in this context. The hard-coded
|
|
uppercase is also inappropriate and there's lots of other
|
|
PG casts that we'd need to support. So instead, use
|
|
text constructs i.e. select(["timestamp '12/05/09'"]).
|
|
|
|
|
|
0.5.4p1
|
|
=======
|
|
|
|
- orm
|
|
- Fixed an attribute error introduced in 0.5.4 which would
|
|
occur when merge() was used with an incomplete object.
|
|
|
|
0.5.4
|
|
=====
|
|
|
|
- orm
|
|
- Significant performance enhancements regarding Sessions/flush()
|
|
in conjunction with large mapper graphs, large numbers of
|
|
objects:
|
|
|
|
- Removed all* O(N) scanning behavior from the flush() process,
|
|
i.e. operations that were scanning the full session,
|
|
including an extremely expensive one that was erroneously
|
|
assuming primary key values were changing when this
|
|
was not the case.
|
|
|
|
* one edge case remains which may invoke a full scan,
|
|
if an existing primary key attribute is modified
|
|
to a new value.
|
|
|
|
- The Session's "weak referencing" behavior is now *full* -
|
|
no strong references whatsoever are made to a mapped object
|
|
or related items/collections in its __dict__. Backrefs and
|
|
other cycles in objects no longer affect the Session's ability
|
|
to lose all references to unmodified objects. Objects with
|
|
pending changes still are maintained strongly until flush.
|
|
[ticket:1398]
|
|
|
|
The implementation also improves performance by moving
|
|
the "resurrection" process of garbage collected items
|
|
to only be relevant for mappings that map "mutable"
|
|
attributes (i.e. PickleType, composite attrs). This removes
|
|
overhead from the gc process and simplifies internal
|
|
behavior.
|
|
|
|
If a "mutable" attribute change is the sole change on an object
|
|
which is then dereferenced, the mapper will not have access to
|
|
other attribute state when the UPDATE is issued. This may present
|
|
itself differently to some MapperExtensions.
|
|
|
|
The change also affects the internal attribute API, but not
|
|
the AttributeExtension interface nor any of the publically
|
|
documented attribute functions.
|
|
|
|
- The unit of work no longer genererates a graph of "dependency"
|
|
processors for the full graph of mappers during flush(), instead
|
|
creating such processors only for those mappers which represent
|
|
objects with pending changes. This saves a tremendous number
|
|
of method calls in the context of a large interconnected
|
|
graph of mappers.
|
|
|
|
- Cached a wasteful "table sort" operation that previously
|
|
occured multiple times per flush, also removing significant
|
|
method call count from flush().
|
|
|
|
- Other redundant behaviors have been simplified in
|
|
mapper._save_obj().
|
|
|
|
- Modified query_cls on DynamicAttributeImpl to accept a full
|
|
mixin version of the AppenderQuery, which allows subclassing
|
|
the AppenderMixin.
|
|
|
|
- The "polymorphic discriminator" column may be part of a
|
|
primary key, and it will be populated with the correct
|
|
discriminator value. [ticket:1300]
|
|
|
|
- Fixed the evaluator not being able to evaluate IS NULL clauses.
|
|
|
|
- Fixed the "set collection" function on "dynamic" relations to
|
|
initiate events correctly. Previously a collection could only
|
|
be assigned to a pending parent instance, otherwise modified
|
|
events would not be fired correctly. Set collection is now
|
|
compatible with merge(), fixes [ticket:1352].
|
|
|
|
- Allowed pickling of PropertyOption objects constructed with
|
|
instrumented descriptors; previously, pickle errors would occur
|
|
when pickling an object which was loaded with a descriptor-based
|
|
option, such as query.options(eagerload(MyClass.foo)).
|
|
|
|
- Lazy loader will not use get() if the "lazy load" SQL clause
|
|
matches the clause used by get(), but contains some parameters
|
|
hardcoded. Previously the lazy strategy would fail with the
|
|
get(). Ideally get() would be used with the hardcoded
|
|
parameters but this would require further development.
|
|
[ticket:1357]
|
|
|
|
- MapperOptions and other state associated with query.options()
|
|
is no longer bundled within callables associated with each
|
|
lazy/deferred-loading attribute during a load.
|
|
The options are now associated with the instance's
|
|
state object just once when it's populated. This removes
|
|
the need in most cases for per-instance/attribute loader
|
|
objects, improving load speed and memory overhead for
|
|
individual instances. [ticket:1391]
|
|
|
|
- Fixed another location where autoflush was interfering
|
|
with session.merge(). autoflush is disabled completely
|
|
for the duration of merge() now. [ticket:1360]
|
|
|
|
- Fixed bug which prevented "mutable primary key" dependency
|
|
logic from functioning properly on a one-to-one
|
|
relation(). [ticket:1406]
|
|
|
|
- Fixed bug in relation(), introduced in 0.5.3,
|
|
whereby a self referential relation
|
|
from a base class to a joined-table subclass would
|
|
not configure correctly.
|
|
|
|
- Fixed obscure mapper compilation issue when inheriting
|
|
mappers are used which would result in un-initialized
|
|
attributes.
|
|
|
|
- Fixed documentation for session weak_identity_map -
|
|
the default value is True, indicating a weak
|
|
referencing map in use.
|
|
|
|
- Fixed a unit of work issue whereby the foreign
|
|
key attribute on an item contained within a collection
|
|
owned by an object being deleted would not be set to
|
|
None if the relation() was self-referential. [ticket:1376]
|
|
|
|
- Fixed Query.update() and Query.delete() failures with eagerloaded
|
|
relations. [ticket:1378]
|
|
|
|
- It is now an error to specify both columns of a binary primaryjoin
|
|
condition in the foreign_keys or remote_side collection. Whereas
|
|
previously it was just nonsensical, but would succeed in a
|
|
non-deterministic way.
|
|
|
|
- schema
|
|
- Added a quote_schema() method to the IdentifierPreparer class
|
|
so that dialects can override how schemas get handled. This
|
|
enables the MSSQL dialect to treat schemas as multipart
|
|
identifiers, such as 'database.owner'. [ticket: 594, 1341]
|
|
|
|
- sql
|
|
- Back-ported the "compiler" extension from SQLA 0.6. This
|
|
is a standardized interface which allows the creation of custom
|
|
ClauseElement subclasses and compilers. In particular it's
|
|
handy as an alternative to text() when you'd like to
|
|
build a construct that has database-specific compilations.
|
|
See the extension docs for details.
|
|
|
|
- Exception messages are truncated when the list of bound
|
|
parameters is larger than 10, preventing enormous
|
|
multi-page exceptions from filling up screens and logfiles
|
|
for large executemany() statements. [ticket:1413]
|
|
|
|
- ``sqlalchemy.extract()`` is now dialect sensitive and can
|
|
extract components of timestamps idiomatically across the
|
|
supported databases, including SQLite.
|
|
|
|
- Fixed __repr__() and other _get_colspec() methods on
|
|
ForeignKey constructed from __clause_element__() style
|
|
construct (i.e. declarative columns). [ticket:1353]
|
|
|
|
- mysql
|
|
- Reflecting a FOREIGN KEY construct will take into account
|
|
a dotted schema.tablename combination, if the foreign key
|
|
references a table in a remote schema. [ticket:1405]
|
|
|
|
- mssql
|
|
- Modified how savepoint logic works to prevent it from
|
|
stepping on non-savepoint oriented routines. Savepoint
|
|
support is still very experimental.
|
|
|
|
- Added in reserved words for MSSQL that covers version 2008
|
|
and all prior versions. [ticket:1310]
|
|
|
|
- Corrected problem with information schema not working with a
|
|
binary collation based database. Cleaned up information schema
|
|
since it is only used by mssql now. [ticket:1343]
|
|
|
|
- sqlite
|
|
- Corrected the SLBoolean type so that it properly treats only 1
|
|
as True. [ticket:1402]
|
|
|
|
- Corrected the float type so that it correctly maps to a
|
|
SLFloat type when being reflected. [ticket:1273]
|
|
|
|
- extensions
|
|
|
|
- Fixed adding of deferred or other column properties to a
|
|
declarative class. [ticket:1379]
|
|
|
|
0.5.3
|
|
=====
|
|
- orm
|
|
- The "objects" argument to session.flush() is deprecated.
|
|
State which represents the linkage between a parent and
|
|
child object does not support "flushed" status on
|
|
one side of the link and not the other, so supporting
|
|
this operation leads to misleading results.
|
|
[ticket:1315]
|
|
|
|
- Query now implements __clause_element__() which produces
|
|
its selectable, which means a Query instance can be accepted
|
|
in many SQL expressions, including col.in_(query),
|
|
union(query1, query2), select([foo]).select_from(query),
|
|
etc.
|
|
|
|
- Query.join() can now construct multiple FROM clauses, if
|
|
needed. Such as, query(A, B).join(A.x).join(B.y)
|
|
might say SELECT A.*, B.* FROM A JOIN X, B JOIN Y.
|
|
Eager loading can also tack its joins onto those
|
|
multiple FROM clauses. [ticket:1337]
|
|
|
|
- Fixed bug in dynamic_loader() where append/remove events
|
|
after construction time were not being propagated to the
|
|
UOW to pick up on flush(). [ticket:1347]
|
|
|
|
- Fixed bug where column_prefix wasn't being checked before
|
|
not mapping an attribute that already had class-level
|
|
name present.
|
|
|
|
- a session.expire() on a particular collection attribute
|
|
will clear any pending backref additions as well, so that
|
|
the next access correctly returns only what was present
|
|
in the database. Presents some degree of a workaround for
|
|
[ticket:1315], although we are considering removing the
|
|
flush([objects]) feature altogether.
|
|
|
|
- Session.scalar() now converts raw SQL strings to text()
|
|
the same way Session.execute() does and accepts same
|
|
alternative **kw args.
|
|
|
|
- improvements to the "determine direction" logic of
|
|
relation() such that the direction of tricky situations
|
|
like mapper(A.join(B)) -> relation-> mapper(B) can be
|
|
determined.
|
|
|
|
- When flushing partial sets of objects using session.flush([somelist]),
|
|
pending objects which remain pending after the operation won't
|
|
inadvertently be added as persistent. [ticket:1306]
|
|
|
|
- Added "post_configure_attribute" method to InstrumentationManager,
|
|
so that the "listen_for_events.py" example works again.
|
|
[ticket:1314]
|
|
|
|
- a forward and complementing backwards reference which are both
|
|
of the same direction, i.e. ONETOMANY or MANYTOONE,
|
|
is now detected, and an error message is raised.
|
|
Saves crazy CircularDependencyErrors later on.
|
|
|
|
- Fixed bugs in Query regarding simultaneous selection of
|
|
multiple joined-table inheritance entities with common base
|
|
classes:
|
|
|
|
- previously the adaption applied to "B" on
|
|
"A JOIN B" would be erroneously partially applied
|
|
to "A".
|
|
|
|
- comparisons on relations (i.e. A.related==someb)
|
|
were not getting adapted when they should.
|
|
|
|
- Other filterings, like
|
|
query(A).join(A.bs).filter(B.foo=='bar'), were erroneously
|
|
adapting "B.foo" as though it were an "A".
|
|
|
|
- Fixed adaptation of EXISTS clauses via any(), has(), etc.
|
|
in conjunction with an aliased object on the left and
|
|
of_type() on the right. [ticket:1325]
|
|
|
|
- Added an attribute helper method ``set_committed_value`` in
|
|
sqlalchemy.orm.attributes. Given an object, attribute name,
|
|
and value, will set the value on the object as part of its
|
|
"committed" state, i.e. state that is understood to have
|
|
been loaded from the database. Helps with the creation of
|
|
homegrown collection loaders and such.
|
|
|
|
- Query won't fail with weakref error when a non-mapper/class
|
|
instrumented descriptor is passed, raises
|
|
"Invalid column expession".
|
|
|
|
- Query.group_by() properly takes into account aliasing applied
|
|
to the FROM clause, such as with select_from(), using
|
|
with_polymorphic(), or using from_self().
|
|
|
|
- sql
|
|
- An alias() of a select() will convert to a "scalar subquery"
|
|
when used in an unambiguously scalar context, i.e. it's used
|
|
in a comparison operation. This applies to
|
|
the ORM when using query.subquery() as well.
|
|
|
|
- Fixed missing _label attribute on Function object, others
|
|
when used in a select() with use_labels (such as when used
|
|
in an ORM column_property()). [ticket:1302]
|
|
|
|
- anonymous alias names now truncate down to the max length
|
|
allowed by the dialect. More significant on DBs like
|
|
Oracle with very small character limits. [ticket:1309]
|
|
|
|
- the __selectable__() interface has been replaced entirely
|
|
by __clause_element__().
|
|
|
|
- The per-dialect cache used by TypeEngine to cache
|
|
dialect-specific types is now a WeakKeyDictionary.
|
|
This to prevent dialect objects from
|
|
being referenced forever for an application that
|
|
creates an arbitrarily large number of engines
|
|
or dialects. There is a small performance penalty
|
|
which will be resolved in 0.6. [ticket:1299]
|
|
|
|
- sqlite
|
|
- Fixed SQLite reflection methods so that non-present
|
|
cursor.description, which triggers an auto-cursor
|
|
close, will be detected so that no results doesn't
|
|
fail on recent versions of pysqlite which raise
|
|
an error when fetchone() called with no rows present.
|
|
|
|
- postgresql
|
|
- Index reflection won't fail when an index with
|
|
multiple expressions is encountered.
|
|
|
|
- Added PGUuid and PGBit types to
|
|
sqlalchemy.databases.postgres. [ticket:1327]
|
|
|
|
- Refection of unknown PG types won't crash when those
|
|
types are specified within a domain. [ticket:1327]
|
|
|
|
- mssql
|
|
- Preliminary support for pymssql 1.0.1
|
|
|
|
- Corrected issue on mssql where max_identifier_length was
|
|
not being respected.
|
|
|
|
- extensions
|
|
|
|
- Fixed a recursive pickling issue in serializer, triggered
|
|
by an EXISTS or other embedded FROM construct.
|
|
|
|
- Declarative locates the "inherits" class using a search
|
|
through __bases__, to skip over mixins that are local
|
|
to subclasses.
|
|
|
|
- Declarative figures out joined-table inheritance primary join
|
|
condition even if "inherits" mapper argument is given
|
|
explicitly.
|
|
|
|
- Declarative will properly interpret the "foreign_keys" argument
|
|
on a backref() if it's a string.
|
|
|
|
- Declarative will accept a table-bound column as a property
|
|
when used in conjunction with __table__, if the column is already
|
|
present in __table__. The column will be remapped to the given
|
|
key the same way as when added to the mapper() properties dict.
|
|
|
|
0.5.2
|
|
======
|
|
|
|
- orm
|
|
- Further refined 0.5.1's warning about delete-orphan cascade
|
|
placed on a many-to-many relation. First, the bad news:
|
|
the warning will apply to both many-to-many as well as
|
|
many-to-one relations. This is necessary since in both
|
|
cases, SQLA does not scan the full set of potential parents
|
|
when determining "orphan" status - for a persistent object
|
|
it only detects an in-python de-association event to establish
|
|
the object as an "orphan". Next, the good news: to support
|
|
one-to-one via a foreign key or assocation table, or to
|
|
support one-to-many via an association table, a new flag
|
|
single_parent=True may be set which indicates objects
|
|
linked to the relation are only meant to have a single parent.
|
|
The relation will raise an error if multiple parent-association
|
|
events occur within Python.
|
|
|
|
- Adjusted the attribute instrumentation change from 0.5.1 to
|
|
fully establish instrumentation for subclasses where the mapper
|
|
was created after the superclass had already been fully
|
|
instrumented. [ticket:1292]
|
|
|
|
- Fixed bug in delete-orphan cascade whereby two one-to-one
|
|
relations from two different parent classes to the same target
|
|
class would prematurely expunge the instance.
|
|
|
|
- Fixed an eager loading bug whereby self-referential eager
|
|
loading would prevent other eager loads, self referential or not,
|
|
from joining to the parent JOIN properly. Thanks to Alex K
|
|
for creating a great test case.
|
|
|
|
- session.expire() and related methods will not expire() unloaded
|
|
deferred attributes. This prevents them from being needlessly
|
|
loaded when the instance is refreshed.
|
|
|
|
- query.join()/outerjoin() will now properly join an aliased()
|
|
construct to the existing left side, even if query.from_self()
|
|
or query.select_from(someselectable) has been called.
|
|
[ticket:1293]
|
|
|
|
- sql
|
|
- Further fixes to the "percent signs and spaces in column/table
|
|
names" functionality. [ticket:1284]
|
|
|
|
- mssql
|
|
- Restored convert_unicode handling. Results were being passed
|
|
on through without conversion. [ticket:1291]
|
|
|
|
- Really fixing the decimal handling this time. [ticket:1282].
|
|
|
|
- Modified table reflection code to use only kwargs when
|
|
constructing tables. [Ticket:1289]
|
|
|
|
0.5.1
|
|
========
|
|
|
|
- orm
|
|
- Removed an internal join cache which could potentially leak
|
|
memory when issuing query.join() repeatedly to ad-hoc
|
|
selectables.
|
|
|
|
- The "clear()", "save()", "update()", "save_or_update()"
|
|
Session methods have been deprecated, replaced by
|
|
"expunge_all()" and "add()". "expunge_all()" has also
|
|
been added to ScopedSession.
|
|
|
|
- Modernized the "no mapped table" exception and added a more
|
|
explicit __table__/__tablename__ exception to declarative.
|
|
|
|
- Concrete inheriting mappers now instrument attributes which
|
|
are inherited from the superclass, but are not defined for
|
|
the concrete mapper itself, with an InstrumentedAttribute that
|
|
issues a descriptive error when accessed. [ticket:1237]
|
|
|
|
- Added a new `relation()` keyword `back_populates`. This
|
|
allows configuation of backreferences using explicit
|
|
relations. [ticket:781] This is required when creating
|
|
bidirectional relations between a hierarchy of concrete
|
|
mappers and another class. [ticket:1237]
|
|
|
|
- Test coverage added for `relation()` objects specified on
|
|
concrete mappers. [ticket:1237]
|
|
|
|
- Query.from_self() as well as query.subquery() both disable
|
|
the rendering of eager joins inside the subquery produced.
|
|
The "disable all eager joins" feature is available publically
|
|
via a new query.enable_eagerloads() generative. [ticket:1276]
|
|
|
|
- Added a rudimental series of set operations to Query that
|
|
receive Query objects as arguments, including union(),
|
|
union_all(), intersect(), except_(), insertsect_all(),
|
|
except_all(). See the API documentation for
|
|
Query.union() for examples.
|
|
|
|
- Fixed bug that prevented Query.join() and eagerloads from
|
|
attaching to a query that selected from a union or aliased union.
|
|
|
|
- A short documentation example added for bidirectional
|
|
relations specified on concrete mappers. [ticket:1237]
|
|
|
|
- Mappers now instrument class attributes upon construction
|
|
with the final InstrumentedAttribute object which remains
|
|
persistent. The `_CompileOnAttr`/`__getattribute__()`
|
|
methodology has been removed. The net effect is that
|
|
Column-based mapped class attributes can now be used fully
|
|
at the class level without invoking a mapper compilation
|
|
operation, greatly simplifying typical usage patterns
|
|
within declarative. [ticket:1269]
|
|
|
|
- ColumnProperty (and front-end helpers such as ``deferred``) no
|
|
longer ignores unknown **keyword arguments.
|
|
|
|
- Fixed a bug with the unitofwork's "row switch" mechanism,
|
|
i.e. the conversion of INSERT/DELETE into an UPDATE, when
|
|
combined with joined-table inheritance and an object
|
|
which contained no defined values for the child table where
|
|
an UPDATE with no SET clause would be rendered.
|
|
|
|
- Using delete-orphan on a many-to-many relation is deprecated.
|
|
This produces misleading or erroneous results since SQLA does
|
|
not retrieve the full list of "parents" for m2m. To get delete-orphan
|
|
behavior with an m2m table, use an explcit association class
|
|
so that the individual association row is treated as a parent.
|
|
[ticket:1281]
|
|
|
|
- delete-orphan cascade always requires delete cascade. Specifying
|
|
delete-orphan without delete now raises a deprecation warning.
|
|
[ticket:1281]
|
|
|
|
- sql
|
|
- Improved the methodology to handling percent signs in column
|
|
names from [ticket:1256]. Added more tests. MySQL and
|
|
PostgreSQL dialects still do not issue correct CREATE TABLE
|
|
statements for identifiers with percent signs in them.
|
|
|
|
- schema
|
|
- Index now accepts column-oriented InstrumentedAttributes
|
|
(i.e. column-based mapped class attributes) as column
|
|
arguments. [ticket:1214]
|
|
|
|
- Column with no name (as in declarative) won't raise a
|
|
NoneType error when it's string output is requsted
|
|
(such as in a stack trace).
|
|
|
|
- Fixed bug when overriding a Column with a ForeignKey
|
|
on a reflected table, where derived columns (i.e. the
|
|
"virtual" columns of a select, etc.) would inadvertently
|
|
call upon schema-level cleanup logic intended only
|
|
for the original column. [ticket:1278]
|
|
|
|
- declarative
|
|
- Can now specify Column objects on subclasses which have no
|
|
table of their own (i.e. use single table inheritance).
|
|
The columns will be appended to the base table, but only
|
|
mapped by the subclass.
|
|
|
|
- For both joined and single inheriting subclasses, the subclass
|
|
will only map those columns which are already mapped on the
|
|
superclass and those explicit on the subclass. Other
|
|
columns that are present on the `Table` will be excluded
|
|
from the mapping by default, which can be disabled
|
|
by passing a blank `exclude_properties` collection to the
|
|
`__mapper_args__`. This is so that single-inheriting
|
|
classes which define their own columns are the only classes
|
|
to map those columns. The effect is actually a more organized
|
|
mapping than you'd normally get with explicit `mapper()`
|
|
calls unless you set up the `exclude_properties` arguments
|
|
explicitly.
|
|
|
|
- It's an error to add new Column objects to a declarative class
|
|
that specified an existing table using __table__.
|
|
|
|
- mysql
|
|
- Added the missing keywords from MySQL 4.1 so they get escaped
|
|
properly.
|
|
|
|
- mssql
|
|
- Corrected handling of large decimal values with more robust
|
|
tests. Removed string manipulation on floats. [ticket:1280]
|
|
|
|
- Modified the do_begin handling in mssql to use the Cursor not
|
|
the Connection so it is DBAPI compatible.
|
|
|
|
- Corrected SAVEPOINT support on adodbapi by changing the
|
|
handling of savepoint_release, which is unsupported on mssql.
|
|
|
|
0.5.0
|
|
========
|
|
|
|
- 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 PostgreSQL, 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'.
|
|
|
|
0.5.0rc4
|
|
========
|
|
- features
|
|
- orm
|
|
- Query.count() has been enhanced to do the "right thing" in a
|
|
wider variety of cases. It can now count multiple-entity
|
|
queries, as well as column-based queries. Note that this means
|
|
if you say query(A, B).count() without any joining criterion,
|
|
it's going to count the cartesian product of A*B. Any query
|
|
which is against column-based entities will automatically
|
|
issue "SELECT count(1) FROM (SELECT...)" so that the real
|
|
rowcount is returned, meaning a query such as
|
|
query(func.count(A.name)).count() will return a value of one,
|
|
since that query would return one row.
|
|
|
|
- Lots of performance tuning. A rough guesstimate over various
|
|
ORM operations places it 10% faster over 0.5.0rc3, 25-30% over
|
|
0.4.8.
|
|
|
|
- bugfixes and behavioral changes
|
|
- general:
|
|
- global "propigate"->"propagate" change.
|
|
|
|
- orm
|
|
- Adjustments to the enhanced garbage collection on
|
|
InstanceState to better guard against errors due to lost
|
|
state.
|
|
|
|
- Query.get() returns a more informative error message when
|
|
executed against multiple entities. [ticket:1220]
|
|
|
|
- Restored NotImplementedError on Cls.relation.in_()
|
|
[ticket:1140] [ticket:1221]
|
|
|
|
- Fixed PendingDeprecationWarning involving order_by parameter
|
|
on relation(). [ticket:1226]
|
|
|
|
- sql
|
|
- Removed the 'properties' attribute of the Connection object,
|
|
Connection.info should be used.
|
|
|
|
- Restored "active rowcount" fetch before ResultProxy autocloses
|
|
the cursor. This was removed in 0.5rc3.
|
|
|
|
- Rearranged the `load_dialect_impl()` method in `TypeDecorator`
|
|
such that it will take effect even if the user-defined
|
|
`TypeDecorator` uses another `TypeDecorator` as its impl.
|
|
|
|
- access
|
|
- Added support for Currency type.
|
|
|
|
- Functions were not return their result. [ticket:1017]
|
|
|
|
- Corrected problem with joins. Access only support LEFT OUTER
|
|
or INNER not just JOIN by itself. [ticket:1017]
|
|
|
|
- mssql
|
|
- Lots of cleanup and fixes to correct problems with limit and
|
|
offset.
|
|
|
|
- Correct situation where subqueries as part of a binary
|
|
expression need to be translated to use the IN and NOT IN
|
|
syntax.
|
|
|
|
- Fixed E Notation issue that prevented the ability to insert
|
|
decimal values less than 1E-6. [ticket:1216]
|
|
|
|
- Corrected problems with reflection when dealing with schemas,
|
|
particularly when those schemas are the default
|
|
schema. [ticket:1217]
|
|
|
|
- Corrected problem with casting a zero length item to a
|
|
varchar. It now correctly adjusts the CAST.
|
|
|
|
- ext
|
|
- Can now use a custom "inherit_condition" in __mapper_args__
|
|
when using declarative.
|
|
|
|
- fixed string-based "remote_side", "order_by" and others not
|
|
propagating correctly when used in backref().
|
|
|
|
0.5.0rc3
|
|
========
|
|
- features
|
|
- orm
|
|
- Added two new hooks to SessionExtension: after_bulk_delete()
|
|
and after_bulk_update(). after_bulk_delete() is called after
|
|
a bulk delete() operation on a query. after_bulk_update() is
|
|
called after a bulk update() operation on a query.
|
|
|
|
- sql
|
|
- SQL compiler optimizations and complexity reduction. The call
|
|
count for compiling a typical select() construct is 20% less
|
|
versus 0.5.0rc2.
|
|
|
|
- Dialects can now generate label names of adjustable
|
|
length. Pass in the argument "label_length=<value>" to
|
|
create_engine() to adjust how many characters max will be
|
|
present in dynamically generated column labels, i.e.
|
|
"somecolumn AS somelabel". Any value less than 6 will result
|
|
in a label of minimal size, consisting of an underscore and a
|
|
numeric counter. The compiler uses the value of
|
|
dialect.max_identifier_length as a default. [ticket:1211]
|
|
|
|
- ext
|
|
- Added a new extension sqlalchemy.ext.serializer. Provides
|
|
Serializer/Deserializer "classes" which mirror
|
|
Pickle/Unpickle, as well as dumps() and loads(). This
|
|
serializer implements an "external object" pickler which keeps
|
|
key context-sensitive objects, including engines, sessions,
|
|
metadata, Tables/Columns, and mappers, outside of the pickle
|
|
stream, and can later restore the pickle using any
|
|
engine/metadata/session provider. This is used not for
|
|
pickling regular object instances, which are pickleable
|
|
without any special logic, but for pickling expression objects
|
|
and full Query objects, such that all mapper/engine/session
|
|
dependencies can be restored at unpickle time.
|
|
|
|
- oracle
|
|
- Wrote a docstring for Oracle dialect. Apparently that Ohloh
|
|
"few source code comments" label is starting to sting :).
|
|
|
|
- Removed FIRST_ROWS() optimize flag when using LIMIT/OFFSET,
|
|
can be reenabled with optimize_limits=True create_engine()
|
|
flag. [ticket:536]
|
|
|
|
- bugfixes and behavioral changes
|
|
- orm
|
|
- "not equals" comparisons of simple many-to-one relation to an
|
|
instance will not drop into an EXISTS clause and will compare
|
|
foreign key columns instead.
|
|
|
|
- Removed not-really-working use cases of comparing a collection
|
|
to an iterable. Use contains() to test for collection
|
|
membership.
|
|
|
|
- Improved the behavior of aliased() objects such that they more
|
|
accurately adapt the expressions generated, which helps
|
|
particularly with self-referential comparisons. [ticket:1171]
|
|
|
|
- Fixed bug involving primaryjoin/secondaryjoin conditions
|
|
constructed from class-bound attributes (as often occurs when
|
|
using declarative), which later would be inappropriately
|
|
aliased by Query, particularly with the various EXISTS based
|
|
comparators.
|
|
|
|
- Fixed bug when using multiple query.join() with an
|
|
aliased-bound descriptor which would lose the left alias.
|
|
|
|
- Improved weakref identity map memory management to no longer
|
|
require mutexing, resurrects garbage collected instance on a
|
|
lazy basis for an InstanceState with pending changes.
|
|
|
|
- InstanceState object now removes circular references to itself
|
|
upon disposal to keep it outside of cyclic garbage collection.
|
|
|
|
- relation() won't hide unrelated ForeignKey errors inside of
|
|
the "please specify primaryjoin" message when determining join
|
|
condition.
|
|
|
|
- Fixed bug in Query involving order_by() in conjunction with
|
|
multiple aliases of the same class (will add tests in
|
|
[ticket:1218])
|
|
|
|
- When using Query.join() with an explicit clause for the ON
|
|
clause, the clause will be aliased in terms of the left side
|
|
of the join, allowing scenarios like query(Source).
|
|
from_self().join((Dest, Source.id==Dest.source_id)) to work
|
|
properly.
|
|
|
|
- polymorphic_union() function respects the "key" of each Column
|
|
if they differ from the column's name.
|
|
|
|
- Repaired support for "passive-deletes" on a many-to-one
|
|
relation() with "delete" cascade. [ticket:1183]
|
|
|
|
- Fixed bug in composite types which prevented a primary-key
|
|
composite type from being mutated [ticket:1213].
|
|
|
|
- Added more granularity to internal attribute access, such that
|
|
cascade and flush operations will not initialize unloaded
|
|
attributes and collections, leaving them intact for a
|
|
lazy-load later on. Backref events still initialize attrbutes
|
|
and collections for pending instances. [ticket:1202]
|
|
|
|
- sql
|
|
- Simplified the check for ResultProxy "autoclose without
|
|
results" to be based solely on presence of
|
|
cursor.description. All the regexp-based guessing about
|
|
statements returning rows has been removed [ticket:1212].
|
|
|
|
- Direct execution of a union() construct will properly set up
|
|
result-row processing. [ticket:1194]
|
|
|
|
- The internal notion of an "OID" or "ROWID" column has been
|
|
removed. It's basically not used by any dialect, and the
|
|
possibility of its usage with psycopg2's cursor.lastrowid is
|
|
basically gone now that INSERT..RETURNING is available.
|
|
|
|
- Removed "default_order_by()" method on all FromClause objects.
|
|
|
|
- Repaired the table.tometadata() method so that a passed-in
|
|
schema argument is propagated to ForeignKey constructs.
|
|
|
|
- Slightly changed behavior of IN operator for comparing to
|
|
empty collections. Now results in inequality comparison
|
|
against self. More portable, but breaks with stored procedures
|
|
that aren't pure functions.
|
|
|
|
- oracle
|
|
- Setting the auto_convert_lobs to False on create_engine() will
|
|
also instruct the OracleBinary type to return the cx_oracle
|
|
LOB object unchanged.
|
|
|
|
- mysql
|
|
- Fixed foreign key reflection in the edge case where a Table's
|
|
explicit schema= is the same as the schema (database) the
|
|
connection is attached to.
|
|
|
|
- No longer expects include_columns in table reflection to be
|
|
lower case.
|
|
|
|
- ext
|
|
- Fixed bug preventing declarative-bound "column" objects from
|
|
being used in column_mapped_collection(). [ticket:1174]
|
|
|
|
- misc
|
|
- util.flatten_iterator() func doesn't interpret strings with
|
|
__iter__() methods as iterators, such as in pypy
|
|
[ticket:1077].
|
|
|
|
0.5.0rc2
|
|
========
|
|
- orm
|
|
- Fixed bug involving read/write relation()s that contain
|
|
literal or other non-column expressions within their
|
|
primaryjoin condition equated to a foreign key column.
|
|
|
|
- "non-batch" mode in mapper(), a feature which allows mapper
|
|
extension methods to be called as each instance is
|
|
updated/inserted, now honors the insert order of the objects
|
|
given.
|
|
|
|
- Fixed RLock-related bug in mapper which could deadlock upon
|
|
reentrant mapper compile() calls, something that occurs when
|
|
using declarative constructs inside of ForeignKey objects.
|
|
|
|
- ScopedSession.query_property now accepts a query_cls factory,
|
|
overriding the session's configured query_cls.
|
|
|
|
- Fixed shared state bug interfering with ScopedSession.mapper's
|
|
ability to apply default __init__ implementations on object
|
|
subclasses.
|
|
|
|
- Fixed up slices on Query (i.e. query[x:y]) to work properly
|
|
for zero length slices, slices with None on either end.
|
|
[ticket:1177]
|
|
|
|
- Added an example illustrating Celko's "nested sets" as a
|
|
SQLA mapping.
|
|
|
|
- contains_eager() with an alias argument works even when
|
|
the alias is embedded in a SELECT, as when sent to the
|
|
Query via query.select_from().
|
|
|
|
- contains_eager() usage is now compatible with a Query that
|
|
also contains a regular eager load and limit/offset, in that
|
|
the columns are added to the Query-generated subquery.
|
|
[ticket:1180]
|
|
|
|
- session.execute() will execute a Sequence object passed to
|
|
it (regression from 0.4).
|
|
|
|
- Removed the "raiseerror" keyword argument from object_mapper()
|
|
and class_mapper(). These functions raise in all cases
|
|
if the given class/instance is not mapped.
|
|
|
|
- Fixed session.transaction.commit() on a autocommit=False
|
|
session not starting a new transaction.
|
|
|
|
- Some adjustments to Session.identity_map's weak referencing
|
|
behavior to reduce asynchronous GC side effects.
|
|
|
|
- Adjustment to Session's post-flush accounting of newly
|
|
"clean" objects to better protect against operating on
|
|
objects as they're asynchronously gc'ed. [ticket:1182]
|
|
|
|
- sql
|
|
- column.in_(someselect) can now be used as a columns-clause
|
|
expression without the subquery bleeding into the FROM clause
|
|
[ticket:1074]
|
|
|
|
- sqlite
|
|
- Overhauled SQLite date/time bind/result processing to use
|
|
regular expressions and format strings, rather than
|
|
strptime/strftime, to generically support pre-1900 dates,
|
|
dates with microseconds. [ticket:968]
|
|
|
|
- String's (and Unicode's, UnicodeText's, etc.) convert_unicode
|
|
logic disabled in the sqlite dialect, to adjust for pysqlite
|
|
2.5.0's new requirement that only Python unicode objects are
|
|
accepted;
|
|
http://itsystementwicklung.de/pipermail/list-pysqlite/2008-March/000018.html
|
|
|
|
- mysql
|
|
- Temporary tables are now reflectable.
|
|
|
|
- oracle
|
|
- Oracle will detect string-based statements which contain
|
|
comments at the front before a SELECT as SELECT statements.
|
|
[ticket:1187]
|
|
|
|
0.5.0rc1
|
|
========
|
|
|
|
- orm
|
|
- Query now has delete() and update(values) methods. This allows
|
|
to perform bulk deletes/updates with the Query object.
|
|
|
|
- The RowTuple object returned by Query(*cols) now features
|
|
keynames which prefer mapped attribute names over column keys,
|
|
column keys over column names, i.e. Query(Class.foo,
|
|
Class.bar) will have names "foo" and "bar" even if those are
|
|
not the names of the underlying Column objects. Direct Column
|
|
objects such as Query(table.c.col) will return the "key"
|
|
attribute of the Column.
|
|
|
|
- Added scalar() and value() methods to Query, each return a
|
|
single scalar value. scalar() takes no arguments and is
|
|
roughly equivalent to first()[0], value()
|
|
takes a single column expression and is roughly equivalent to
|
|
values(expr).next()[0].
|
|
|
|
- Improved the determination of the FROM clause when placing SQL
|
|
expressions in the query() list of entities. In particular
|
|
scalar subqueries should not "leak" their inner FROM objects
|
|
out into the enclosing query.
|
|
|
|
- Joins along a relation() from a mapped class to a mapped
|
|
subclass, where the mapped subclass is configured with single
|
|
table inheritance, will include an IN clause which limits the
|
|
subtypes of the joined class to those requested, within the ON
|
|
clause of the join. This takes effect for eager load joins as
|
|
well as query.join(). Note that in some scenarios the IN
|
|
clause will appear in the WHERE clause of the query as well
|
|
since this discrimination has multiple trigger points.
|
|
|
|
- AttributeExtension has been refined such that the event
|
|
is fired before the mutation actually occurs. Additionally,
|
|
the append() and set() methods must now return the given value,
|
|
which is used as the value to be used in the mutation operation.
|
|
This allows creation of validating AttributeListeners which
|
|
raise before the action actually occurs, and which can change
|
|
the given value into something else before its used.
|
|
|
|
- column_property(), composite_property(), and relation() now
|
|
accept a single or list of AttributeExtensions using the
|
|
"extension" keyword argument.
|
|
|
|
- query.order_by().get() silently drops the "ORDER BY" from
|
|
the query issued by GET but does not raise an exception.
|
|
|
|
- Added a Validator AttributeExtension, as well as a
|
|
@validates decorator which is used in a similar fashion
|
|
as @reconstructor, and marks a method as validating
|
|
one or more mapped attributes.
|
|
|
|
- class.someprop.in_() raises NotImplementedError pending the
|
|
implementation of "in_" for relation [ticket:1140]
|
|
|
|
- Fixed primary key update for many-to-many collections where
|
|
the collection had not been loaded yet [ticket:1127]
|
|
|
|
- Fixed bug whereby deferred() columns with a group in conjunction
|
|
with an otherwise unrelated synonym() would produce
|
|
an AttributeError during deferred load.
|
|
|
|
- The before_flush() hook on SessionExtension takes place before
|
|
the list of new/dirty/deleted is calculated for the final
|
|
time, allowing routines within before_flush() to further
|
|
change the state of the Session before the flush proceeds.
|
|
[ticket:1128]
|
|
|
|
- The "extension" argument to Session and others can now
|
|
optionally be a list, supporting events sent to multiple
|
|
SessionExtension instances. Session places SessionExtensions
|
|
in Session.extensions.
|
|
|
|
- Reentrant calls to flush() raise an error. This also serves
|
|
as a rudimentary, but not foolproof, check against concurrent
|
|
calls to Session.flush().
|
|
|
|
- Improved the behavior of query.join() when joining to
|
|
joined-table inheritance subclasses, using explicit join
|
|
criteria (i.e. not on a relation).
|
|
|
|
- @orm.attributes.on_reconstitute and
|
|
MapperExtension.on_reconstitute have been renamed to
|
|
@orm.reconstructor and MapperExtension.reconstruct_instance
|
|
|
|
- Fixed @reconstructor hook for subclasses which inherit from a
|
|
base class. [ticket:1129]
|
|
|
|
- The composite() property type now supports a
|
|
__set_composite_values__() method on the composite class which
|
|
is required if the class represents state using attribute
|
|
names other than the column's keynames; default-generated
|
|
values now get populated properly upon flush. Also,
|
|
composites with attributes set to None compare correctly.
|
|
[ticket:1132]
|
|
|
|
- The 3-tuple of iterables returned by attributes.get_history()
|
|
may now be a mix of lists and tuples. (Previously members
|
|
were always lists.)
|
|
|
|
- Fixed bug whereby changing a primary key attribute on an
|
|
entity where the attribute's previous value had been expired
|
|
would produce an error upon flush(). [ticket:1151]
|
|
|
|
- Fixed custom instrumentation bug whereby get_instance_dict()
|
|
was not called for newly constructed instances not loaded
|
|
by the ORM.
|
|
|
|
- Session.delete() adds the given object to the session if
|
|
not already present. This was a regression bug from 0.4.
|
|
[ticket:1150]
|
|
|
|
- The `echo_uow` flag on `Session` is deprecated, and unit-of-work
|
|
logging is now application-level only, not per-session level.
|
|
|
|
- Removed conflicting `contains()` operator from
|
|
`InstrumentedAttribute` which didn't accept `escape` kwaarg
|
|
[ticket:1153].
|
|
|
|
- declarative
|
|
- Fixed bug whereby mapper couldn't initialize if a composite
|
|
primary key referenced another table that was not defined
|
|
yet. [ticket:1161]
|
|
|
|
- Fixed exception throw which would occur when string-based
|
|
primaryjoin condition was used in conjunction with backref.
|
|
|
|
- schema
|
|
- Added "sorted_tables" accessor to MetaData, which returns
|
|
Table objects sorted in order of dependency as a list.
|
|
This deprecates the MetaData.table_iterator() method.
|
|
The "reverse=False" keyword argument has also been
|
|
removed from util.sort_tables(); use the Python
|
|
'reversed' function to reverse the results.
|
|
[ticket:1033]
|
|
|
|
- The 'length' argument to all Numeric types has been renamed
|
|
to 'scale'. 'length' is deprecated and is still accepted
|
|
with a warning.
|
|
|
|
- Dropped 0.3-compatibility for user defined types
|
|
(convert_result_value, convert_bind_param).
|
|
|
|
- sql
|
|
- Temporarily rolled back the "ORDER BY" enhancement from
|
|
[ticket:1068]. This feature is on hold pending further
|
|
development.
|
|
|
|
- The exists() construct won't "export" its contained list
|
|
of elements as FROM clauses, allowing them to be used more
|
|
effectively in the columns clause of a SELECT.
|
|
|
|
- and_() and or_() now generate a ColumnElement, allowing
|
|
boolean expressions as result columns, i.e.
|
|
select([and_(1, 0)]). [ticket:798]
|
|
|
|
- Bind params now subclass ColumnElement which allows them to be
|
|
selectable by orm.query (they already had most ColumnElement
|
|
semantics).
|
|
|
|
- Added select_from() method to exists() construct, which becomes
|
|
more and more compatible with a regular select().
|
|
|
|
- Added func.min(), func.max(), func.sum() as "generic functions",
|
|
which basically allows for their return type to be determined
|
|
automatically. Helps with dates on SQLite, decimal types,
|
|
others. [ticket:1160]
|
|
|
|
- added decimal.Decimal as an "auto-detect" type; bind parameters
|
|
and generic functions will set their type to Numeric when a
|
|
Decimal is used.
|
|
|
|
- mysql
|
|
- The 'length' argument to MSInteger, MSBigInteger, MSTinyInteger,
|
|
MSSmallInteger and MSYear has been renamed to 'display_width'.
|
|
|
|
- Added MSMediumInteger type [ticket:1146].
|
|
|
|
- the function func.utc_timestamp() compiles to UTC_TIMESTAMP, without
|
|
the parenthesis, which seem to get in the way when using in
|
|
conjunction with executemany().
|
|
|
|
- oracle
|
|
- limit/offset no longer uses ROW NUMBER OVER to limit rows,
|
|
and instead uses subqueries in conjunction with a special
|
|
Oracle optimization comment. Allows LIMIT/OFFSET to work
|
|
in conjunction with DISTINCT. [ticket:536]
|
|
- has_sequence() now takes the current "schema" argument into
|
|
account [ticket:1155]
|
|
- added BFILE to reflected type names [ticket:1121]
|
|
|
|
0.5beta3
|
|
========
|
|
|
|
0.5beta3 includes all bugfixes listed under release "0.4.7".
|
|
|
|
- orm
|
|
- The "entity_name" feature of SQLAlchemy mappers has been
|
|
removed. For rationale, see http://tinyurl.com/6nm2ne
|
|
|
|
- the "autoexpire" flag on Session, sessionmaker(), and
|
|
scoped_session() has been renamed to "expire_on_commit". It
|
|
does not affect the expiration behavior of rollback().
|
|
|
|
- fixed endless loop bug which could occur within a mapper's
|
|
deferred load of inherited attributes.
|
|
|
|
- a legacy-support flag "_enable_transaction_accounting" flag
|
|
added to Session which when False, disables all
|
|
transaction-level object accounting, including expire on
|
|
rollback, expire on commit, new/deleted list maintenance, and
|
|
autoflush on begin.
|
|
|
|
- The 'cascade' parameter to relation() accepts None as a value,
|
|
which is equivalent to no cascades.
|
|
|
|
- A critical fix to dynamic relations allows the "modified"
|
|
history to be properly cleared after a flush().
|
|
|
|
- user-defined @properties on a class are detected and left in
|
|
place during mapper initialization. This means that a
|
|
table-bound column of the same name will not be mapped at all
|
|
if a @property is in the way (and the column is not remapped
|
|
to a different name), nor will an instrumented attribute from
|
|
an inherited class be applied. The same rules apply for names
|
|
excluded using the include_properties/exclude_properties
|
|
collections.
|
|
|
|
- Added a new SessionExtension hook called after_attach(). This
|
|
is called at the point of attachment for objects via add(),
|
|
add_all(), delete(), and merge().
|
|
|
|
- A mapper which inherits from another, when inheriting the
|
|
columns of its inherited mapper, will use any reassigned
|
|
property names specified in that inheriting mapper.
|
|
Previously, if "Base" had reassigned "base_id" to the name
|
|
"id", "SubBase(Base)" would still get an attribute called
|
|
"base_id". This could be worked around by explicitly stating
|
|
the column in each submapper as well but this is fairly
|
|
unworkable and also impossible when using declarative
|
|
[ticket:1111].
|
|
|
|
- Fixed a series of potential race conditions in Session whereby
|
|
asynchronous GC could remove unmodified, no longer referenced
|
|
items from the session as they were present in a list of items
|
|
to be processed, typically during session.expunge_all() and
|
|
dependent methods.
|
|
|
|
- Some improvements to the _CompileOnAttr mechanism which should
|
|
reduce the probability of "Attribute x was not replaced during
|
|
compile" warnings. (this generally applies to SQLA hackers,
|
|
like Elixir devs).
|
|
|
|
- Fixed bug whereby the "unsaved, pending instance" FlushError
|
|
raised for a pending orphan would not take superclass mappers
|
|
into account when generating the list of relations responsible
|
|
for the error.
|
|
|
|
- sql
|
|
- func.count() with no arguments renders as COUNT(*), equivalent
|
|
to func.count(text('*')).
|
|
|
|
- simple label names in ORDER BY expressions render as
|
|
themselves, and not as a re-statement of their corresponding
|
|
expression. This feature is currently enabled only for
|
|
SQLite, MySQL, and PostgreSQL. It can be enabled on other
|
|
dialects as each is shown to support this
|
|
behavior. [ticket:1068]
|
|
|
|
- ext
|
|
- Class-bound attributes sent as arguments to relation()'s
|
|
remote_side and foreign_keys parameters are now accepted,
|
|
allowing them to be used with declarative. Additionally fixed
|
|
bugs involving order_by being specified as a class-bound
|
|
attribute in conjunction with eager loading.
|
|
|
|
- declarative initialization of Columns adjusted so that
|
|
non-renamed columns initialize in the same way as a non
|
|
declarative mapper. This allows an inheriting mapper to set
|
|
up its same-named "id" columns in particular such that the
|
|
parent "id" column is favored over the child column, reducing
|
|
database round trips when this value is requested.
|
|
|
|
- mysql
|
|
- Quoting of MSEnum values for use in CREATE TABLE is now
|
|
optional & will be quoted on demand as required. (Quoting was
|
|
always optional for use with existing tables.) [ticket:1110]
|
|
|
|
0.5beta2
|
|
========
|
|
|
|
0.5beta2 includes some of the bugfixes listed under release "0.4.7".
|
|
|
|
- orm
|
|
- In addition to expired attributes, deferred attributes also
|
|
load if their data is present in the result set. [ticket:870]
|
|
|
|
- session.refresh() raises an informative error message if the
|
|
list of attributes does not include any column-based
|
|
attributes.
|
|
|
|
- query() raises an informative error message if no columns or
|
|
mappers are specified.
|
|
|
|
- lazy loaders now trigger autoflush before proceeding. This
|
|
allows expire() of a collection or scalar relation to function
|
|
properly in the context of autoflush.
|
|
|
|
- column_property() attributes which represent SQL expressions
|
|
or columns that are not present in the mapped tables (such as
|
|
those from views) are automatically expired after an INSERT or
|
|
UPDATE, assuming they have not been locally modified, so that
|
|
they are refreshed with the most recent data upon access.
|
|
[ticket:887]
|
|
|
|
- Fixed explicit, self-referential joins between two
|
|
joined-table inheritance mappers when using query.join(cls,
|
|
aliased=True). [ticket:1082]
|
|
|
|
- Fixed query.join() when used in conjunction with a
|
|
columns-only clause and an SQL-expression ON clause in the
|
|
join.
|
|
|
|
- The "allow_column_override" flag from mapper() has been
|
|
removed. This flag is virtually always misunderstood. Its
|
|
specific functionality is available via the
|
|
include_properties/exclude_properties mapper arguments.
|
|
|
|
- Repaired `__str__()` method on Query. [ticket:1066]
|
|
|
|
- Session.bind gets used as a default even when table/mapper
|
|
specific binds are defined.
|
|
|
|
- schema
|
|
- Added prefixes option to `Table` that accepts a list of
|
|
strings to insert after CREATE in the CREATE TABLE statement.
|
|
[ticket:1075]
|
|
|
|
- Unicode, UnicodeText types now set "assert_unicode" and
|
|
"convert_unicode" by default, but accept overriding
|
|
**kwargs for these values.
|
|
|
|
- sql
|
|
- Added new match() operator that performs a full-text search.
|
|
Supported on PostgreSQL, SQLite, MySQL, MS-SQL, and Oracle
|
|
backends.
|
|
|
|
- sqlite
|
|
- Modified SQLite's representation of "microseconds" to match
|
|
the output of str(somedatetime), i.e. in that the microseconds
|
|
are represented as fractional seconds in string format. This
|
|
makes SQLA's SQLite date type compatible with datetimes that
|
|
were saved directly using Pysqlite (which just calls str()).
|
|
Note that this is incompatible with the existing microseconds
|
|
values in a SQLA 0.4 generated SQLite database file.
|
|
|
|
To get the old behavior globally:
|
|
|
|
from sqlalchemy.databases.sqlite import DateTimeMixin
|
|
DateTimeMixin.__legacy_microseconds__ = True
|
|
|
|
To get the behavior on individual DateTime types:
|
|
|
|
t = sqlite.SLDateTime()
|
|
t.__legacy_microseconds__ = True
|
|
|
|
Then use "t" as the type on the Column.
|
|
|
|
[ticket:1090]
|
|
|
|
- SQLite Date, DateTime, and Time types only accept Python
|
|
datetime objects now, not strings. If you'd like to format
|
|
dates as strings yourself with SQLite, use a String type. If
|
|
you'd like them to return datetime objects anyway despite
|
|
their accepting strings as input, make a TypeDecorator around
|
|
String - SQLA doesn't encourage this pattern.
|
|
|
|
- extensions
|
|
- Declarative supports a __table_args__ class variable, which is
|
|
either a dictionary, or tuple of the form (arg1, arg2, ...,
|
|
{kwarg1:value, ...}) which contains positional + kw arguments
|
|
to be passed to the Table constructor. [ticket:1096]
|
|
|
|
0.5beta1
|
|
========
|
|
|
|
An ongoing document describing the changes from 0.4 to 0.5 is at:
|
|
http://www.sqlalchemy.org/trac/wiki/05Migration
|
|
|
|
For this section, the list below primarily lists changes within the
|
|
attribute instrumentation API and is only a small fraction of the
|
|
full changes between 0.4/0.5.
|
|
|
|
-orm
|
|
- The "__init__" trigger/decorator added by mapper now attempts
|
|
to exactly mirror the argument signature of the original
|
|
__init__. The pass-through for '_sa_session' is no longer
|
|
implicit- you must allow for this keyword argument in your
|
|
constructor.
|
|
|
|
- ClassState is renamed to ClassManager.
|
|
|
|
- Classes may supply their own InstrumentationManager by
|
|
providing a __sa_instrumentation_manager__ property.
|
|
|
|
- Custom instrumentation may use any mechanism to associate a
|
|
ClassManager with a class and an InstanceState with an
|
|
instance. Attributes on those objects are still the default
|
|
association mechanism used by SQLAlchemy's native
|
|
instrumentation.
|
|
|
|
- Moved entity_name, _sa_session_id, and _instance_key from the
|
|
instance object to the instance state. These values are still
|
|
available in the old way, which is now deprecated, using
|
|
descriptors attached to the class. A deprecation warning will
|
|
be issued when accessed.
|
|
|
|
- The _prepare_instrumentation alias for prepare_instrumentation
|
|
has been removed.
|
|
|
|
- sqlalchemy.exceptions has been renamed to sqlalchemy.exc. The
|
|
module may be imported under either name.
|
|
|
|
- ORM-related exceptions are now defined in sqlalchemy.orm.exc.
|
|
ConcurrentModificationError, FlushError, and
|
|
UnmappedColumnError compatibility aliases are installed in
|
|
sqlalchemy.exc during the import of sqlalchemy.orm.
|
|
|
|
- sqlalchemy.logging has been renamed to sqlalchemy.log.
|
|
|
|
- The transitional sqlalchemy.log.SADeprecationWarning alias for
|
|
the warning's definition in sqlalchemy.exc has been removed.
|
|
|
|
- exc.AssertionError has been removed and usage replaced with
|
|
Python's built-in AssertionError.
|
|
|
|
- The behavior of MapperExtensions attached to multiple,
|
|
entity_name= primary mappers for a single class has been
|
|
altered. The first mapper() defined for a class is the only
|
|
mapper eligible for the MapperExtension 'instrument_class',
|
|
'init_instance' and 'init_failed' events. This is backwards
|
|
incompatible; previously the extensions of last mapper defined
|
|
would receive these events.
|
|
|
|
- firebird
|
|
- Added support for returning values from inserts (2.0+ only),
|
|
updates and deletes (2.1+ only).
|
|
|
|
For changes prior to 0.5, see CHANGES_PRE_05
|
|
|