Mike Bayer [Tue, 24 Apr 2012 22:06:27 +0000 (18:06 -0400)]
- [feature] Calling rollback() within a
session.begin_nested() will now only expire
those objects that had net changes within the
scope of that transaction, that is objects which
were dirty or were modified on a flush. This
allows the typical use case for begin_nested(),
that of altering a small subset of objects, to
leave in place the data from the larger enclosing
set of objects that weren't modified in
that sub-transaction. [ticket:2452]
- inline the "register_newly_XYZ" functions to operate
upon collections to reduce method calls
Mike Bayer [Tue, 24 Apr 2012 20:44:53 +0000 (16:44 -0400)]
- [feature] postgresql.ARRAY features an optional
"dimension" argument, will assign a specific
number of dimensions to the array which will
render in DDL as ARRAY[][]..., also improves
performance of bind/result processing.
[ticket:2441]
Mike Bayer [Tue, 24 Apr 2012 20:27:58 +0000 (16:27 -0400)]
- [feature] The "unconsumed column names" warning emitted
when keys are present in insert.values() or update.values()
that aren't in the target table is now an exception.
[ticket:2415]
Mike Bayer [Tue, 24 Apr 2012 20:25:20 +0000 (16:25 -0400)]
- [feature] Inspector.get_primary_keys() is
deprecated; use Inspector.get_pk_constraint().
Courtesy Diana Clarke. [ticket:2422]
- restored default get_primary_keys()/get_pk_constraint() wrapper
to help maintain compatibility with third party dialects
created against 0.6 or 0.7
Mike Bayer [Tue, 24 Apr 2012 20:08:35 +0000 (16:08 -0400)]
- [bug] All of UniqueConstraint, ForeignKeyConstraint,
CheckConstraint, and PrimaryKeyConstraint will
attach themselves to their parent table automatically
when they refer to a Table-bound Column object directly
(i.e. not just string column name), and refer to
one and only one Table. Prior to 0.8 this behavior
occurred for UniqueConstraint and PrimaryKeyConstraint,
but not ForeignKeyConstraint or CheckConstraint.
[ticket:2410]
Mike Bayer [Tue, 24 Apr 2012 20:03:00 +0000 (16:03 -0400)]
- [feature] The behavior of column targeting
in result sets is now case sensitive by
default. SQLAlchemy for many years would
run a case-insensitive conversion on these values,
probably to alleviate early case sensitivity
issues with dialects like Oracle and
Firebird. These issues have been more cleanly
solved in more modern versions so the performance
hit of calling lower() on identifiers is removed.
The case insensitive comparisons can be re-enabled
by setting "case_insensitive=False" on
create_engine(). [ticket:2423]
Mike Bayer [Tue, 24 Apr 2012 19:52:09 +0000 (15:52 -0400)]
- [feature] The after_attach event is now
emitted after the object is established
in Session.new or Session.identity_map
upon Session.add(), Session.merge(),
etc., so that the object is represented
in these collections when the event
is called. [ticket:2464]
Mike Bayer [Tue, 24 Apr 2012 19:49:52 +0000 (15:49 -0400)]
- [feature] the SQLite date and time types
have been overhauled to support a more open
ended format for input and output, using
name based format strings and regexps. A
new argument "microseconds" also provides
the option to omit the "microseconds"
portion of timestamps. Thanks to
Nathan Wright for the work and tests on
this. [ticket:2363]
Mike Bayer [Sun, 1 Apr 2012 23:42:54 +0000 (19:42 -0400)]
- sql
- [bug] Removed warning when Index is created
with no columns; while this might not be what
the user intended, it is a valid use case
as an Index could be a placeholder for just an
index of a certain name.
- mssql
- [feature] Added interim create_engine flag
supports_unicode_binds to PyODBC dialect,
to force whether or not the dialect
passes Python unicode literals to PyODBC
or not.
Mike Bayer [Sat, 31 Mar 2012 17:35:05 +0000 (13:35 -0400)]
- [bug] Fixed bug in expression annotation
mechanics which could lead to incorrect
rendering of SELECT statements with aliases
and joins, particularly when using
column_property(). [ticket:2453]
Mike Bayer [Sat, 31 Mar 2012 16:55:42 +0000 (12:55 -0400)]
- [bug] Fixed bug whereby polymorphic_on
column that's not otherwise mapped on the
class would be incorrectly included
in a merge() operation, raising an error.
[ticket:2449]
Mike Bayer [Wed, 21 Mar 2012 00:12:26 +0000 (20:12 -0400)]
- 0.7.7
- [feature] Added prefix_with() method
to Query, calls upon select().prefix_with()
to allow placement of MySQL SELECT
directives in statements. Courtesy
Diana Clarke [ticket:2443]
Mike Bayer [Wed, 14 Mar 2012 21:34:36 +0000 (14:34 -0700)]
- [bug] Fixed issue whereby attribute-based
column access on a row would raise
AttributeError with non-C version,
NoSuchColumnError with C version. Now
raises AttributeError in both cases.
[ticket:2398]
Mike Bayer [Wed, 14 Mar 2012 21:32:13 +0000 (14:32 -0700)]
- [feature] Added support for MySQL index and
primary key constraint types
(i.e. USING) via new mysql_using parameter
to Index and PrimaryKeyConstraint,
courtesy Diana Clarke. [ticket:2386]
Mike Bayer [Wed, 14 Mar 2012 03:38:30 +0000 (20:38 -0700)]
- [bug] Fixed bug in C extensions whereby
string format would not be applied to a
Numeric value returned as integer; this
affected primarily SQLite which does
not maintain numeric scale settings.
[ticket:2432]
Nathan Wright [Tue, 13 Mar 2012 04:31:12 +0000 (21:31 -0700)]
Improve SQLite DATETIME storage format handling [ticket:2363]
This breaks backwards compatibility with old SQLite DATETIME, DATE,
and TIME storage_format strings. Formatting now occurs with named instead
of positional parameters. The regexp argument can still use positional
arguments, but named groupings are also supported. This means that you can
omit fields and change the order of date fields as desired.
SQLite's DATETIME and TIME also gained a truncate_microseconds argument.
This is shorthand for modifying the format string. Fortunately the
str_to_datetime and str_to_time processors written in C already support
omitting microseconds, so we don't have to resort to python processing
for this case.
Mike Bayer [Tue, 24 Apr 2012 17:04:38 +0000 (13:04 -0400)]
- [bug] column.label(None) now produces an
anonymous label, instead of returning the
column object itself, consistent with the behavior
of label(column, None). [ticket:2168]
Mike Bayer [Tue, 24 Apr 2012 17:00:30 +0000 (13:00 -0400)]
- [feature] Added a new system
for registration of new dialects in-process
without using an entrypoint. See the
docs for "Registering New Dialects".
[ticket:2462]
Mike Bayer [Tue, 24 Apr 2012 16:01:04 +0000 (12:01 -0400)]
- [feature] The column_reflect event now
accepts the Inspector object as the first
argument, preceding "table". Code which
uses the 0.7 version of this very new
event will need modification to add the
"inspector" object as the first argument.
[ticket:2418]
Mike Bayer [Tue, 24 Apr 2012 15:58:14 +0000 (11:58 -0400)]
- [bug] The warning emitted when using
delete-orphan cascade with one-to-many
or many-to-many without single-parent=True
is now an error. The ORM
would fail to function subsequent to this
warning in any case. [ticket:2405]
Mike Bayer [Tue, 24 Apr 2012 15:55:04 +0000 (11:55 -0400)]
- [bug] The "passive" flag on Session.is_modified()
no longer has any effect. is_modified() in
all cases looks only at local in-memory
modified flags and will not emit any
SQL or invoke loader callables/initializers.
[ticket:2320]
Mike Bayer [Tue, 24 Apr 2012 15:24:23 +0000 (11:24 -0400)]
- [bug] The names of the columns on the
.c. attribute of a select().apply_labels()
is now based on <tablename>_<colkey> instead
of <tablename>_<colname>, for those columns
that have a distinctly named .key.
[ticket:2397]
Mike Bayer [Tue, 24 Apr 2012 15:16:03 +0000 (11:16 -0400)]
- [bug] removed legacy behavior whereby
a column comparison to a scalar SELECT via
== would coerce to an IN with the SQL server
dialect. This is implicit
behavior which fails in other scenarios
so is removed. Code which relies on this
needs to be modified to use column.in_(select)
explicitly. [ticket:2277]
Mike Bayer [Tue, 24 Apr 2012 02:17:25 +0000 (22:17 -0400)]
- [feature] New standalone function with_polymorphic()
provides the functionality of query.with_polymorphic()
in a standalone form. It can be applied to any
entity within a query, including as the target
of a join in place of the "of_type()" modifier.
[ticket:2333]
- redo a large portion of the inheritance docs in terms
of declarative, new with_polymorphic() function
- upgrade examples/inheritance/polymorph, rename to "joined"
Mike Bayer [Mon, 23 Apr 2012 22:59:17 +0000 (18:59 -0400)]
- [removed] The legacy "mutable" system of the
ORM, including the MutableType class as well
as the mutable=True flag on PickleType
and postgresql.ARRAY has been removed.
In-place mutations are detected by the ORM
using the sqlalchemy.ext.mutable extension,
introduced in 0.7. The removal of MutableType
and associated constructs removes a great
deal of complexity from SQLAlchemy's internals.
The approach performed poorly as it would incur
a scan of the full contents of the Session
when in use. [ticket:2442]
Mike Bayer [Sun, 22 Apr 2012 23:43:31 +0000 (19:43 -0400)]
- merged #1401 branch from bitbucket
- resolved some serious speed hits I missed, we need to ensure
only deannotated columns are used in the local/remote collections and soforth
so that hash lookups against mapped columns don't dig into __eq__()
- fix some other parity mismatches regarding stuff from [ticket:2453],
including finding another case where _deep_annotate() was doing the wrong thing,
new tests.
- [feature] Major rewrite of relationship()
internals now allow join conditions which
include columns pointing to themselves
within composite foreign keys. A new
API for very specialized primaryjoin conditions
is added, allowing conditions based on
SQL functions, CAST, etc. to be handled
by placing the annotation functions
remote() and foreign() inline within the
expression when necessary. Previous recipes
using the semi-private _local_remote_pairs
approach can be upgraded to this new
approach. [ticket:1401]
Mike Bayer [Thu, 19 Apr 2012 16:31:15 +0000 (12:31 -0400)]
- [bug] Fixed bug in 0.7.6 introduced by
[ticket:2409] whereby column_mapped_collection
used against columns that were mapped as
joins or other indirect selectables
would fail to function.
Here, the serialize use case has gotten very complex since to
really target a column we'd need the root MetaData object,
then if we're hitting Alias objects and such there's really
nothing to hold onto. Short of building a system where
Column objects have some kind of master hash identifier that
is consistently generated, the way this works can't really
suit every case - much easier would be to change the mechanics
of collections.py to make available the Mapper to the
collection adapter when it's first invoked.
Mike Bayer [Wed, 18 Apr 2012 23:52:58 +0000 (19:52 -0400)]
- [bug] UPDATE..FROM syntax with SQL Server
requires that the updated table be present
in the FROM clause when an alias of that
table is also present in the FROM clause.
The updated table is now always present
in the FROM, when FROM is present
in the first place. Courtesy sayap.
[ticket:2468]
Mike Bayer [Mon, 16 Apr 2012 16:08:32 +0000 (12:08 -0400)]
- mysql [bug] Fixed bug whereby if cast() is used
on a SQL expression whose type is not supported
by cast() and therefore CAST isn't rendered by
the dialect, the order of evaluation could change
if the casted expression required that it be
grouped; grouping is now applied to those
expressions. [ticket:2467]
Mike Bayer [Thu, 12 Apr 2012 18:38:52 +0000 (14:38 -0400)]
- [bug] If conn.begin() fails when calling
"with engine.begin()", the newly acquired
Connection is closed explicitly before
propagating the exception onward normally.
Mike Bayer [Wed, 11 Apr 2012 17:03:52 +0000 (13:03 -0400)]
- [feature] Added new flag to @validates
include_removes. When True, collection
remove and attribute del events
will also be sent to the validation function,
which accepts an additional argument
"is_remove" when this flag is used.
Mike Bayer [Tue, 10 Apr 2012 23:38:22 +0000 (19:38 -0400)]
- [feature] Added new connection event
dbapi_error(). Is called for all DBAPI-level
errors passing the original DBAPI exception
before SQLAlchemy modifies the state
of the cursor.
Mike Bayer [Sun, 8 Apr 2012 15:18:39 +0000 (11:18 -0400)]
- adjust mysql patch a bit so that we use
built in quoting for the "idx_" name as well
- [bug] Fixed bug whereby column name inside
of "KEY" clause for autoincrement composite
column with InnoDB would double quote a
name that's a reserved word. Courtesy Jeff
Dairiki. [ticket:2460]
Mike Bayer [Thu, 5 Apr 2012 18:31:28 +0000 (14:31 -0400)]
- [bug] Repaired the use_scope_identity
create_engine() flag when using the pyodbc
dialect. Previously this flag would be
ignored if set to False. When set to False,
you'll get "SELECT @@identity" after each
INSERT to get at the last inserted ID,
for those tables which have "implicit_returning"
set to False.
Mike Bayer [Wed, 4 Apr 2012 23:08:05 +0000 (19:08 -0400)]
- the inspect interface is done, needs docs.
- start dressing up InstanceState for it's coming out, start moving
internal things to be underscored within the lib
Mike Bayer [Mon, 12 Mar 2012 20:35:27 +0000 (13:35 -0700)]
- [bug] Fixed bug whereby a primaryjoin
condition with a "literal" in it would
raise an error on compile with certain
kinds of deeply nested expressions
which also needed to render the same
bound parameter name more than once.
[ticket:2425]
Mike Bayer [Mon, 12 Mar 2012 20:14:14 +0000 (13:14 -0700)]
- add __table_cls__ option to declarative, not publicized yet, is for the moment
for the benefit of the test.lib.schema package.
- use test.lib.schema.Table for the table within test.lib.fixtures.DeclarativeMappedTest
- [bug] Removed the check for number of
rows affected when doing a multi-delete
against mapped objects. If an ON DELETE
CASCADE exists between two rows, we can't
get an accurate rowcount from the DBAPI;
this particular count is not supported
on most DBAPIs in any case, MySQLdb
is the notable case where it is.
[ticket:2403]
Mike Bayer [Sun, 11 Mar 2012 00:18:52 +0000 (16:18 -0800)]
- [bug] Fixed memory leak in core which would
occur when C extensions were used with
particular types of result fetches,
in particular when orm query.count()
were called. [ticket:2427]
Mike Bayer [Thu, 8 Mar 2012 03:36:22 +0000 (22:36 -0500)]
- [bug] Fixed event registration bug
which would primarily show up as
events not being registered with
sessionmaker() instances created
after the event was associated
with the Session class. [ticket:2424]