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.
Mike Bayer [Tue, 5 Aug 2008 20:15:28 +0000 (20:15 +0000)]
- 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.
Mike Bayer [Mon, 4 Aug 2008 15:21:29 +0000 (15:21 +0000)]
- fixed endless loop bug which could occur
within a mapper's deferred load of
inherited attributes.
- 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.
Mike Bayer [Sun, 3 Aug 2008 21:19:32 +0000 (21:19 +0000)]
- compiler visit_label() checks a flag "within_order_by" and will render its own name
and not its contained expression, if the dialect reports true for supports_simple_order_by_label.
the flag is not propagated forwards, meant to closely mimic the syntax Postgres expects which is
that only a simple name can be in the ORDER BY, not a more complex expression or function call
with the label name embedded (mysql and sqlite support more complex expressions).
This further sets the standard for propigation of **kwargs within compiler, that we can't just send
**kwargs along blindly to each XXX.process() call; whenever a **kwarg needs to propagate through,
most methods will have to be aware of it and know when they should send it on forward and when not.
This was actually already the case with result_map as well.
The supports_simple_order_by dialect flag defaults to True but is conservatively explicitly set to
False on all dialects except SQLite/MySQL/Postgres to start.
Mike Bayer [Sun, 3 Aug 2008 18:03:57 +0000 (18:03 +0000)]
- renamed autoexpire to expire_on_commit
- renamed SessionTransaction autoflush to reentrant_flush to more clearly state its purpose
- added _enable_transaction_accounting, flag for Mike Bernson which disables the whole 0.5 transaction state management; the system depends on expiry on rollback in order to function.
Mike Bayer [Sun, 3 Aug 2008 16:52:31 +0000 (16:52 +0000)]
a correction to the recent should_exclude change. should_exclude is a little mixed
up as to when it honors "column_prefix" and when it doesn't, depending on whether or not
the prop is coming from a column name or from an inherited class. Will need more testing
to uncover potential issues here.
Mike Bayer [Sat, 2 Aug 2008 22:21:42 +0000 (22:21 +0000)]
- The "entity_name" feature of SQLAlchemy mappers
has been removed. For rationale, see
http://groups.google.com/group/sqlalchemy/browse_thread/thread/9e23a0641a88b96d?hl=en
Jason Kirtland [Sat, 2 Aug 2008 17:07:33 +0000 (17:07 +0000)]
- Refactored declarative_base() as a thin wrapper over type()
- The supplied __init__ is now optional
- The name of the generated class can be specified
- Accepts multiple bases
Mike Bayer [Thu, 31 Jul 2008 16:41:41 +0000 (16:41 +0000)]
- 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.
Michael Trier [Wed, 23 Jul 2008 05:10:04 +0000 (05:10 +0000)]
Corrected problem with detecting closed connections. Fixed issues in reflecttable for reflecting the mssql tables. Removed unicode reflection test from mssql. Need to investigate this further.
Mike Bayer [Sun, 20 Jul 2008 18:23:44 +0000 (18:23 +0000)]
- An inheriting class can now override an attribute
inherited from the base class with a plain descriptor,
or exclude an inherited attribute via the
include_properties/exclude_properties collections.
Mike Bayer [Sat, 19 Jul 2008 19:23:37 +0000 (19:23 +0000)]
- 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).
Mike Bayer [Sat, 19 Jul 2008 18:55:11 +0000 (18:55 +0000)]
- 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.
Mike Bayer [Sat, 19 Jul 2008 18:18:50 +0000 (18:18 +0000)]
- reverted r4955, that was wrong. The backref responsible for the operation is the one where the "cascade" option should take effect.
- can use None as a value for cascade.
- documented cascade options in docstring, [ticket:1064]
Mike Bayer [Fri, 18 Jul 2008 22:11:22 +0000 (22:11 +0000)]
- save-update and delete-orphan cascade event handler
now considers the cascade rules of the event initiator only, not the local
attribute. This way the cascade of the initiator controls the behavior
regardless of backref events.
Mike Bayer [Fri, 18 Jul 2008 17:42:11 +0000 (17:42 +0000)]
- 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.
Mike Bayer [Wed, 16 Jul 2008 21:56:23 +0000 (21:56 +0000)]
- MapperProperty gets its .key attribute assigned early, in _compile_property.
MapperProperty compilation is detected using a "_compiled" flag.
- 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].
Jason Kirtland [Wed, 16 Jul 2008 18:24:20 +0000 (18:24 +0000)]
- mysql.MSEnum value literals now automatically quoted when used in a CREATE.
The change is backward compatible. Slight expansion of patch from catlee.
Thanks! [ticket:1110]