Mike Bayer [Sat, 30 Jul 2011 16:12:32 +0000 (12:12 -0400)]
- Fixed bug where query.join() + aliased=True
from a joined-inh structure to itself on
relationship() with join condition on the child
table would convert the lead entity into the
joined one inappropriately. [ticket:2234]
Also in 0.6.9.
Mike Bayer [Sat, 30 Jul 2011 15:41:53 +0000 (11:41 -0400)]
- Added public attribute ".validators" to
Mapper, an immutable dictionary view of
all attributes that have been decorated
with the @validates decorator.
[ticket:2240] courtesy Stefano Fontanelli
Mike Bayer [Thu, 28 Jul 2011 15:53:18 +0000 (11:53 -0400)]
- SQLite dialect no longer strips quotes
off of reflected default value, allowing
a round trip CREATE TABLE to work.
This is consistent with other dialects
that also maintain the exact form of
the default. [ticket:2189]
Mike Bayer [Mon, 25 Jul 2011 00:41:42 +0000 (20:41 -0400)]
- rework Annotated to no longer use __cmp__(), supply an __eq__() that
works with ColumnElement as well as works with non-__eq__() suppliers,
works with sets, on Py3K as well.
Mike Bayer [Sun, 24 Jul 2011 21:51:01 +0000 (17:51 -0400)]
- rewrite cloned_traverse() and replacement_traverse() to use a straight
recursive descent with clone() + _copy_internals(). This is essentially
what it was doing anyway with lots of unnecessary steps.
Fix Alias() to honor the given clone() function which may have been the
reason the traversal hadn't been fixed sooner. Alias._copy_internals()
will specifically skip an alias of a Table
as a more specific form of what it was doing before. This may need to
be further improved such that ClauseAdapter or replacement_traverse()
send it some specific hints what not to dig into; **kw has been added
to all _copy_internals() to support this. replacement/clone traversal
is at least clear now.
- apply new no_replacement_traverse annotation to join created by
_create_joins(), fixes [ticket:2195]
- can replace orm.query "_halt_adapt" with "no_replacement_traverse"
Mike Bayer [Sun, 24 Jul 2011 16:37:48 +0000 (12:37 -0400)]
- Fixed regression from 0.6 where Session.add()
against an object which contained None in a
collection would raise an internal exception.
Reverted this to 0.6's behavior which is to
accept the None but obviously nothing is
persisted. Ideally, collections with None
present or on append() should at least emit a
warning, which is being considered for 0.8.
[ticket:2205]
Mike Bayer [Sun, 24 Jul 2011 15:45:30 +0000 (11:45 -0400)]
- Fixed bug apparent only in Python 3 whereby
sorting of persistent + pending objects during
flush would produce an illegal comparison,
if the persistent object primary key
is not a single integer. [ticket:2228]
Also in 0.6.9
Mike Bayer [Thu, 21 Jul 2011 15:44:31 +0000 (11:44 -0400)]
- Added an informative error message when
ForeignKeyConstraint refers to a column name in
the parent that is not found. Also in 0.6.9.
- add tests for [ticket:2226], as if we hit each @declared_attr
directly with obj.__get__(obj, name) instead of using
getattr(cls, name). Basic inheritance mechanics are improperly
used in this case, so 2226 is invalid.
Mike Bayer [Wed, 20 Jul 2011 22:30:57 +0000 (18:30 -0400)]
- Fixed regression from 0.6 where a get history
operation on some relationship() based attributes
would fail when a lazyload would emit; this could
trigger within a flush() under certain conditions.
[ticket:2224] Thanks to the user who submitted
the great test for this.
Mike Bayer [Wed, 20 Jul 2011 22:03:35 +0000 (18:03 -0400)]
- Fixed bug whereby the source clause
used by query.join() would be inconsistent
if against a column expression that combined
multiple entities together. [ticket:2197]
Mike Bayer [Wed, 20 Jul 2011 14:49:36 +0000 (10:49 -0400)]
- Added new "postgresql_ops" argument to
Index, allows specification of PostgreSQL
operator classes for indexed columns.
[ticket:2198] Courtesy Filip Zyzniewski.
Mike Bayer [Sun, 17 Jul 2011 20:44:37 +0000 (16:44 -0400)]
- Fixed bug whereby if a mapped class
redefined __hash__() or __eq__() to something
non-standard, which is a supported use case
as SQLA should never consult these,
the methods would be consulted if the class
was part of a "composite" (i.e. non-single-entity)
result set. [ticket:2215]
Also in 0.6.9.
Mike Bayer [Sun, 17 Jul 2011 19:14:03 +0000 (15:14 -0400)]
- Feature enhancement: joined and subquery
loading will now traverse already-present related
objects and collections in search of unpopulated
attributes throughout the scope of the eager load
being defined, so that the eager loading that is
specified via mappings or query options
unconditionally takes place for the full depth,
populating whatever is not already populated.
Previously, this traversal would stop if a related
object or collection were already present leading
to inconsistent behavior (though would save on
loads/cycles for an already-loaded graph). For a
subqueryload, this means that the additional
SELECT statements emitted by subqueryload will
invoke unconditionally, no matter how much of the
existing graph is already present (hence the
controversy). The previous behavior of "stopping"
is still in effect when a query is the result of
an attribute-initiated lazyload, as otherwise an
"N+1" style of collection iteration can become
needlessly expensive when the same related object
is encountered repeatedly. There's also an
as-yet-not-public generative Query method
_with_invoke_all_eagers()
which selects old/new behavior [ticket:2213]
Mike Bayer [Thu, 7 Jul 2011 15:34:59 +0000 (11:34 -0400)]
- add a latex Makefile to texinputs that gets copied on latex build,
ensures pdflatex/latex errors are totally ignored
- fix all SQL/code examples in the inherits doc to be within 79 chars.
will need to do this for all the docs to get pdf to not look crappy.
- add an abspath to the "templates" dir, not sure of the rationale
here but is harmless, [ticket:2211]
- integrate pdf build with site-mako build
Mike Bayer [Wed, 6 Jul 2011 16:35:45 +0000 (12:35 -0400)]
- The join condition produced by with_parent
as well as when using a "dynamic" relationship
against a parent will generate unique
bindparams, rather than incorrectly repeating
the same bindparam. [ticket:2207].
Also in 0.6.9.
Mike Bayer [Mon, 4 Jul 2011 20:31:58 +0000 (16:31 -0400)]
- fix pypostgresql typo, [ticket:2185]
- rewrite "getting a session" docs to delineate
all sessionmaker() use cases distinctly
- rewrite "Managing Transactions" doc to spell out
each specific step completely, [ticket:2204]
- add to create_engine() and main "engine" doc
an unambiguous statement that the create_engine()
does not create a connection
- other link fixes
- rewrite "deleting" section so that "deleting from collections"
is separate, well-described, [ticket:2202]
- rephrase "autocommit mode" into its own section, move it down,
put some bold text that you shouldn't be using it.
- simplify the "subtransactions" section and make it local to
"autocommit" since it is utterly unneeded by anybody.
- oracle is not doing 2-phase anytime soon
Mike Bayer [Mon, 4 Jul 2011 17:56:17 +0000 (13:56 -0400)]
- Added an improved repr() to TypeEngine objects
that will only display constructor args which
are positional or kwargs that deviate
from the default. [ticket:2209]
Mike Bayer [Fri, 1 Jul 2011 21:09:57 +0000 (17:09 -0400)]
- add doc to schema docs linking to declarative usage of __table__
- add more examples to __table__ such as that asked on a recent
stackoverflow question.
Mike Bayer [Fri, 1 Jul 2011 20:52:11 +0000 (16:52 -0400)]
- Failures on connect which raise dbapi.Error
will forward the error to dialect.is_disconnect()
and set the "connection_invalidated" flag if
the dialect knows this to be a potentially
"retryable" condition. Only Oracle ORA-01033
implemented for now. [ticket:2201]
- Added ORA-01033 to disconnect codes, which
can be caught during a connection
event. [ticket:2201]
Mike Bayer [Fri, 1 Jul 2011 15:32:07 +0000 (11:32 -0400)]
- Fixed bug in the mutable extension whereby
if None or a non-corresponding type were set,
an error would be raised. None is now accepted
which assigns None to all attributes,
illegal values raise ValueError.
Mike Bayer [Thu, 30 Jun 2011 22:48:01 +0000 (18:48 -0400)]
- Fixed bug where "autoincrement" detection on
Table would fail if the type had no "affinity"
value, in particular this would occur when using
the UUID example on the site that uses TypeEngine
as the "impl".
Mike Bayer [Thu, 30 Jun 2011 14:43:53 +0000 (10:43 -0400)]
- Fixed bug in the mutable extension whereby
if the same type were used twice in one
mapping, the attributes beyond the first
would not get instrumented.
Mike Bayer [Thu, 30 Jun 2011 14:27:52 +0000 (10:27 -0400)]
- Fixed bug whereby adaptation of old append_ddl_listener()
function was passing unexpected **kw through
to the Table event. Table gets no kws, the MetaData
event in 0.6 would get "tables=somecollection",
this behavior is preserved. [ticket:2206]
Mike Bayer [Mon, 27 Jun 2011 23:25:35 +0000 (19:25 -0400)]
- Fixed subtle bug that caused SQL to blow
up if: column_property() against subquery +
joinedload + LIMIT + order by the column
property() occurred. [ticket:2188].
Also in 0.6.9
Mike Bayer [Thu, 23 Jun 2011 23:54:50 +0000 (19:54 -0400)]
- the "cascade" section of the session doc was totally screwed up, mappings
used the wrong form, example for cascade_backref used the wrong names.
- rewrite relationship cascade_backrefs doc
Mike Bayer [Wed, 22 Jun 2011 15:45:28 +0000 (11:45 -0400)]
- Added mixin class sqlalchemy.ext.DontWrapMixin.
User-defined exceptions of this type are never
wrapped in StatementException when they
occur in the context of a statement
execution.
- StatementException wrapping will display the
original exception class in the message.
Mike Bayer [Tue, 21 Jun 2011 14:01:46 +0000 (10:01 -0400)]
- Repaired the "no statement condition"
assertion in Query which would attempt
to raise if a generative method were called
after from_statement() were called.
[ticket:2199]. Also in 0.6.9.
Mike Bayer [Thu, 16 Jun 2011 16:09:45 +0000 (12:09 -0400)]
- Repaired the examples/versioning test runner
to not rely upon SQLAlchemy test libs,
nosetests must be run from within
examples/versioning to get around setup.cfg
breaking it.
- Tweak to examples/versioning to pick the
correct foreign key in a multi-level
inheritance situation.
Mike Bayer [Tue, 14 Jun 2011 14:08:34 +0000 (10:08 -0400)]
- Fixed declarative bug where a class inheriting
from a superclass of the same name would fail
due to an unnecessary lookup of the name
in the _decl_class_registry. [ticket:2194]
Mike Bayer [Mon, 13 Jun 2011 00:35:37 +0000 (20:35 -0400)]
- Fixed bug whereby comparison of column
expression to a Query() would not call
as_scalar() on the underlying SELECT
statement to produce a scalar subquery,
in the way that occurs if you called
it on Query().subquery(). [ticket:2190]
- some cleanup to test.orm.test_query
Mike Bayer [Tue, 7 Jun 2011 02:24:07 +0000 (22:24 -0400)]
- Adjusted the pyodbc dialect such that bound
values are passed as bytes and not unicode
if the "Easysoft" unix drivers are detected.
This is the same behavior as occurs with
FreeTDS. Easysoft appears to segfault
if Python unicodes are passed under
certain circumstances.
Mike Bayer [Sun, 5 Jun 2011 16:22:34 +0000 (12:22 -0400)]
- Fixed bug where transaction-level "deleted"
collection wouldn't be cleared of expunged
states, raising an error if they later
became transient [ticket:2182].
Also in 0.6.8.
Mike Bayer [Sun, 5 Jun 2011 15:58:26 +0000 (11:58 -0400)]
- Added a workaround for Python bug 7511 where
failure of C extension build does not
raise an appropriate exception on Windows 64
bit + VC express [ticket:2184]
Mike Bayer [Sun, 5 Jun 2011 00:52:30 +0000 (20:52 -0400)]
- Adjusted the __contains__() method of
a RowProxy result row such that no exception
throw is generated internally;
NoSuchColumnError() also will generate its
message regardless of whether or not the column
construct can be coerced to a string.
[ticket:2178]. Also in 0.6.8.
Mike Bayer [Sun, 5 Jun 2011 00:20:28 +0000 (20:20 -0400)]
- Some unit test fixes regarding numeric arrays,
MATCH operator. A potential floating-point
inaccuracy issue was fixed, and certain tests
of the MATCH operator only execute within an
EN-oriented locale for now. [ticket:2175].
Also in 0.6.8.
Mike Bayer [Sun, 5 Jun 2011 00:04:29 +0000 (20:04 -0400)]
- Modify the text of the message which occurs
when the "identity" key isn't detected on
flush, to include the common cause that
the Column isn't set up to detect
auto-increment correctly; [ticket:2170].
Also in 0.6.8.
Mike Bayer [Sat, 4 Jun 2011 23:53:24 +0000 (19:53 -0400)]
- Accept None from SQLite cursor.fetchone() when
"PRAGMA read_uncommitted" is called to determine
current isolation mode at connect time and
default to SERIALIZABLE; this to support SQLite
versions pre-3.3.0 that did not have this
feature. [ticket:2173]
Mike Bayer [Sat, 4 Jun 2011 23:43:39 +0000 (19:43 -0400)]
- Repaired new "mutable" extension to propagate
events to subclasses correctly; don't
create multiple event listeners for
subclasses either. [ticket:2180]
Mike Bayer [Sat, 4 Jun 2011 23:01:52 +0000 (19:01 -0400)]
- "delete-orphan" cascade is now allowed on
self-referential relationships - this since
SQLA 0.7 no longer enforces "parent with no
child" at the ORM level; this check is left
up to foreign key nullability.
Related to [ticket:1912]
- a lot of cleanup and refactoring on relationship()
init, clarification
Mike Bayer [Thu, 2 Jun 2011 23:52:26 +0000 (19:52 -0400)]
- Unit tests pass 100% on MySQL installed
on windows, after aggressive exclusion of a wide variety
of tests. Not clear to what degree the failures are related to
version 5.5 vs. the usage of windows, in particular the ON UPDATE CASCADE
immediately crashes the server. The features being tested here are all
edge cases not likely to be used in typical MySQL environments.
- Removed the "adjust casing" step that would
fail when reflecting a table on MySQL
on windows with a mixed case name. After some
experimenting with a windows MySQL server, it's
been determined that this step wasn't really
helping the situation much; MySQL does not return
FK names with proper casing on non-windows
platforms either, and removing the step at
least allows the reflection to act more like
it does on other OSes. A warning here
has been considered but its difficult to
determine under what conditions such a warning
can be raised, so punted on that for now -
added some docs instead. [ticket:2181]
- supports_sane_rowcount will be set to False
if using MySQLdb and the DBAPI doesn't provide
the constants.CLIENT module.
Mike Bayer [Thu, 2 Jun 2011 06:52:40 +0000 (02:52 -0400)]
- Deprecate schema/SQL-oriented methods on
Connection/Engine that were never well known
and are redundant: reflecttable(), create(),
drop(), text(), engine.func
- lots of docstrings in engine
Mike Bayer [Thu, 2 Jun 2011 00:25:33 +0000 (20:25 -0400)]
take out a little cruft. Spend two hours trying to make things simpler,
maybe we dont need state.callables (nope we do), maybe we can move populate_state out
(nope we lose speed that way), things are the way they are...
Mike Bayer [Sun, 29 May 2011 00:24:57 +0000 (20:24 -0400)]
- move Operators and ColumnOperators into sqlalchemy.sql.operators - since this
is strictly a system of routing Python operators into functions. Keep the
references available in expression.py for the near future.
Mike Bayer [Sat, 28 May 2011 17:28:38 +0000 (13:28 -0400)]
- Streamlined the process by which a Select
determines what's in it's '.c' collection.
Behaves identically, except that a
raw ClauseList() passed to select([])
(which is not a documented case anyway) will
now be expanded into its individual column
elements instead of being ignored.