Mike Bayer [Fri, 19 Sep 2008 22:59:28 +0000 (22:59 +0000)]
- 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]
Get a bit more speed into the new _sort_states function. It's probably possible
to get even more speed by getting rid of the decorator and call the method
directly, but it makes for slightly less readable code so I won't do it since I
don't know whether this code is speed-critical or not.
Mike Bayer [Fri, 19 Sep 2008 01:34:28 +0000 (01:34 +0000)]
- 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.
- fixed UnmappedColumnError exception raise to not assume it was passed a column
Mike Bayer [Thu, 18 Sep 2008 21:41:37 +0000 (21:41 +0000)]
- "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.
- added some tests, some commented out, involving [ticket:1171]
Mike Bayer [Tue, 16 Sep 2008 18:17:34 +0000 (18:17 +0000)]
- version bump
- turned properties in sql/expressions.py to @property
- column.in_(someselect) can now be used as
a columns-clause expression without the subquery
bleeding into the FROM clause [ticket:1074]
Mike Bayer [Mon, 15 Sep 2008 21:29:28 +0000 (21:29 +0000)]
- annual unitofwork cleanup
- moved conversion of cyclical sort to UOWTask structure to be non-recursive
- reduced some verbosity
- rationale for the "tree" sort clarified
- would love to flatten all of uow topological sorting, sorting within mapper._save_obj() into a single sort someday
Mike Bayer [Thu, 11 Sep 2008 19:35:40 +0000 (19:35 +0000)]
- 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].
Mike Bayer [Wed, 10 Sep 2008 21:09:04 +0000 (21:09 +0000)]
- 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().
Mike Bayer [Mon, 8 Sep 2008 22:50:37 +0000 (22:50 +0000)]
- 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]
Mike Bayer [Mon, 8 Sep 2008 03:51:47 +0000 (03:51 +0000)]
- 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.
Mike Bayer [Fri, 5 Sep 2008 17:16:11 +0000 (17:16 +0000)]
- rearranged delete() so that the object is attached before
cascades fire off [ticket:5058]
- after_attach() only fires if the object was not previously attached
Mike Bayer [Wed, 3 Sep 2008 16:53:05 +0000 (16:53 +0000)]
- 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]
Mike Bayer [Tue, 2 Sep 2008 19:51:48 +0000 (19:51 +0000)]
- column_property(), composite_property(), and relation() now
accept a single or list of AttributeExtensions using the
"extension" keyword argument.
- 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.
- removed validate_attributes example, the new methodology replaces it
Mike Bayer [Tue, 2 Sep 2008 17:57:35 +0000 (17:57 +0000)]
- AttributeListener has been refined such that the event
is fired before the mutation actually occurs. Addtionally,
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.
A new example "validate_attributes.py" shows one such recipe
for doing this. AttributeListener helper functions are
also on the way.
Mike Bayer [Fri, 29 Aug 2008 16:31:58 +0000 (16:31 +0000)]
- 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.
Mike Bayer [Thu, 28 Aug 2008 18:21:42 +0000 (18:21 +0000)]
- starargs_as_list was not actually issuing SAPendingDeprecationWarning, fixed
- implemented code cleanup from [ticket:1152] but not including using the decorators module
Mike Bayer [Thu, 28 Aug 2008 17:11:18 +0000 (17:11 +0000)]
- Fixed bug whereby deferred() columns with a group in conjunction
with an otherwise unrelated synonym() would produce
an AttributeError during deferred load.
Mike Bayer [Sun, 24 Aug 2008 21:52:38 +0000 (21:52 +0000)]
- 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]
Mike Bayer [Sun, 24 Aug 2008 21:10:36 +0000 (21:10 +0000)]
- logging scale-back; the echo_uow flag on Session is deprecated, and unit of work logging is now
class level like all the other logging.
- trimmed back the logging API, centralized class_logger() as the single point of configuration for
logging, removed per-instance logging checks from ORM.
- Engine and Pool logging remain at the instance level. The modulus of "instance ids" has been upped
to 65535. I'd like to remove the modulus altogether but I do see a couple of users each month
calling create_engine() on a per-request basis, an incorrect practice but I'd rather their applications
don't just run out of memory.
Mike Bayer [Sun, 24 Aug 2008 19:52:54 +0000 (19:52 +0000)]
- The 'length' argument to all Numeric types has been renamed
to 'scale'. 'length' is deprecated and is still accepted
with a warning. [ticket:827]
- The 'length' argument to MSInteger, MSBigInteger, MSTinyInteger,
MSSmallInteger and MSYear has been renamed to 'display_width'.
[ticket:827]
- mysql._Numeric now consumes 'unsigned' and 'zerofill' from
the given kw, so that the same kw can be passed along to Numeric
and allow the 'length' deprecation logic to still take effect
- added testlib.engines.all_dialects() to return a dialect for
every db module
- informix added to sqlalchemy.databases.__all__. Since other
"experimental" dbs like access and sybase are there, informix
should be as well.
Mike Bayer [Fri, 22 Aug 2008 15:09:27 +0000 (15:09 +0000)]
- attributes now has an "active_history" flag. This flag indicates that when new value is set or the existing value is deleted, we absolutely need the previous value to be present, including if it requires hitting a lazy loader. Since somewhere around 0.4 we had not been loading the previous value as a performance optimization.
- the flag is set by a ColumnLoader which contains a primary key column. This allows the mapper to have an accurate record of a primary key column when _save_obj() performs an UPDATE.
- the definition of who gets "active_history" may be expanded to include ForeignKey and any columns participating in a primaryjoin/seconddary join, so that lazyloaders can execute correctly on an expired object with pending changes to those attributes.
- expire-on-commit is why this is becoming a more important issue as of late
- fixes [ticket:1151], but unit tests, CHANGES note is pending
Mike Bayer [Thu, 21 Aug 2008 18:10:35 +0000 (18:10 +0000)]
- column_property() and synonym() both accept comparator_factory argument, allowing
custom comparison functionality
- made the mapper's checks for user-based descriptors when defining synonym or comparable property
stronger, such that a synonym can be used with declarative without having a user-based descriptor
Gaëtan de Menten [Thu, 21 Aug 2008 09:12:54 +0000 (09:12 +0000)]
- Fix occurences of Class.c.column_name
- Fix a few typos/mistakes
- removed trailing whitespaces
- tried to achieve a more consistent syntax for spaces in properties
declaration
Mike Bayer [Tue, 19 Aug 2008 21:27:34 +0000 (21:27 +0000)]
- fixed a bug in declarative test which was looking for old version of history
- 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]
Mike Bayer [Sun, 17 Aug 2008 22:21:23 +0000 (22:21 +0000)]
- 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]
- Reentrant calls to flush() raise an error. This also
serves as a rudimentary, but not foolproof, check against
concurrent calls to Session.flush().
Mike Bayer [Wed, 13 Aug 2008 22:41:17 +0000 (22:41 +0000)]
- with 2.3 support dropped,
all usage of thread.get_ident() is removed, and replaced
with threading.local() usage. this allows potentially
faster and safer thread local access.
Mike Bayer [Tue, 12 Aug 2008 20:31:14 +0000 (20:31 +0000)]
- 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 requsted, 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.
Mike Bayer [Mon, 11 Aug 2008 17:18:10 +0000 (17:18 +0000)]
- 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]
Mike Bayer [Wed, 6 Aug 2008 20:58:48 +0000 (20:58 +0000)]
- 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.