Mike Bayer [Wed, 24 Apr 2013 22:58:09 +0000 (18:58 -0400)]
- attempt to replace the whole idea of "join_to_left" with a more
fundamental and general purpose heuristic. this initial approach
has about 60 tests failing but seems to have gone pretty far
Mike Bayer [Tue, 23 Apr 2013 17:23:48 +0000 (13:23 -0400)]
Added a conditional to the unpickling process for ORM
mapped objects, such that if the reference to the object
were lost when the object was pickled, we don't
erroneously try to set up _sa_instance_state - fixes
a NoneType error.
Mike Bayer [Mon, 22 Apr 2013 23:33:39 +0000 (19:33 -0400)]
Opened up the checking for "disconnect" with psycopg2/libpq
to check for all the various "disconnect" messages within
the full exception hierarchy. Specifically the
"closed the connection unexpectedly" message has now been
seen in at least three different exception types.
[ticket:2712]
Mike Bayer [Mon, 22 Apr 2013 23:12:47 +0000 (19:12 -0400)]
Fully implemented the IS and IS NOT operators with
regards to the True/False constants. An expression like
``col.is_(True)`` will now render ``col IS true``
on the target platform, rather than converting the True/
False constant to an integer bound parameter.
This allows the ``is_()`` operator to work on MySQL when
given True/False constants.
[ticket:2682]
Mike Bayer [Mon, 22 Apr 2013 20:57:15 +0000 (16:57 -0400)]
The operators for the Postgresql ARRAY type supports
input types of sets, generators, etc. but only when a dimension
is specified for the ARRAY; otherwise, the dialect
needs to peek inside of "arr[0]" to guess how many
dimensions are in use. If this occurs with a non
list/tuple type, the error message is now informative
and directs to specify a dimension for the ARRAY.
[ticket:2681]
Mike Bayer [Sun, 21 Apr 2013 21:09:45 +0000 (17:09 -0400)]
- Improvements to the operation of the pymysql dialect on
Python 3, including some important decode/bytes steps.
Issues remain with BLOB types due to driver issues.
Courtesy Ben Trofatter.
- start using util.py3k, we will eventually remove the
sa2to3 fixer entirely
Mike Bayer [Sun, 21 Apr 2013 15:31:29 +0000 (11:31 -0400)]
Fixed bug where many-to-many relationship with uselist=False
would fail to delete the association row and raise an error
if the scalar attribute were set to None. Also in 0.7.11.
[ticket:2710]
Mike Bayer [Sat, 20 Apr 2013 06:45:08 +0000 (02:45 -0400)]
Improved the behavior of instance management regarding
the creation of strong references within the Session;
an object will no longer have an internal reference cycle
created if it's in the transient state or moves into the
detached state - the strong ref is created only when the
object is attached to a Session and is removed when the
object is detached. This makes it somewhat safer for an
object to have a `__del__()` method, even though this is
not recommended, as relationships with backrefs produce
cycles too. A warning has been added when a class with
a `__del__()` method is mapped.
[ticket:2708]
Dan Ring [Sat, 20 Apr 2013 01:01:39 +0000 (18:01 -0700)]
Fix mysql+gaerdbms dialect for changed exception format
googleappengine v1.7.5 changed the exception format to be
incompatible with MySQLDialect_gaerdbms#_extract_error_code
This fix works for both old- and new-style exceptions.
Changes causing the breakage:
/trunk/python/google/storage/speckle/python/api/rdbms.py
at
https://code.google.com/p/googleappengine/source/detail?r=318
Mike Bayer [Fri, 19 Apr 2013 00:11:08 +0000 (20:11 -0400)]
Fixed a long-standing bug in the caching example, where
the limit/offset parameter values wouldn't be taken into
account when computing the cache key. The
_key_from_query() function has been simplified to work
directly from the final compiled statement in order to get
at both the full statement as well as the fully processed
parameter list.
Mike Bayer [Thu, 18 Apr 2013 21:41:30 +0000 (17:41 -0400)]
- this pymssql test needs to be against the pymssql dialect
- Part of a longer series of fixes needed for pyodbc+
mssql, a CAST to NVARCHAR(max) has been added to the bound
parameter for the table name and schema name in all information schema
queries to avoid the issue of comparing NVARCHAR to NTEXT,
which seems to be rejected by the ODBC driver in some cases,
such as FreeTDS (0.91 only?) plus unicode bound parameters being passed.
The issue seems to be specific to the SQL Server information
schema tables and the workaround is harmless for those cases
where the problem doesn't exist in the first place.
[ticket:2355]
Mike Bayer [Thu, 18 Apr 2013 15:00:12 +0000 (11:00 -0400)]
Reworked internal exception raises that emit
a rollback() before re-raising, so that the stack
trace is preserved from sys.exc_info() before entering
the rollback. This so that the traceback is preserved
when using coroutine frameworks which may have switched
contexts before the rollback function returns.
[ticket:2703]
Mike Bayer [Fri, 12 Apr 2013 00:04:57 +0000 (20:04 -0400)]
Fixed bug whereby ORM would run the wrong kind of
query when refreshing an inheritance-mapped class
where the superclass was mapped to a non-Table
object, like a custom join() or a select(),
running a query that assumed a hierarchy that's
mapped to individual Table-per-class.
[ticket:2697]
Mike Bayer [Thu, 11 Apr 2013 23:37:56 +0000 (19:37 -0400)]
Fixed `__repr__()` on mapper property constructs
to work before the object is initialized, so
that Sphinx builds with recent Sphinx versions
can read them.
Mike Bayer [Thu, 11 Apr 2013 23:34:46 +0000 (19:34 -0400)]
The _Binary base type now converts values through
the bytes() callable when run on Python 3; in particular
psycopg2 2.5 with Python 3.3 seems to now be returning
the "memoryview" type, so this is converted to bytes
before return.
Mike Bayer [Thu, 11 Apr 2013 23:10:02 +0000 (19:10 -0400)]
Improvements to Connection auto-invalidation
handling. If a non-disconnect error occurs,
but leads to a delayed disconnect error within error
handling (happens with MySQL), the disconnect condition
is detected. The Connection can now also be closed
when in an invalid state, meaning it will raise "closed"
on next usage, and additionally the "close with result"
feature will work even if the autorollback in an error
handling routine fails and regardless of whether the
condition is a disconnect or not.
[ticket:2695]
Mike Bayer [Thu, 11 Apr 2013 20:14:23 +0000 (16:14 -0400)]
A major fix to the way in which a select() object produces
labeled columns when apply_labels() is used; this mode
produces a SELECT where each column is labeled as in
<tablename>_<columnname>, to remove column name collisions
for a multiple table select. The fix is that if two labels
collide when combined with the table name, i.e.
"foo.bar_id" and "foo_bar.id", anonymous aliasing will be
applied to one of the dupes. This allows the ORM to handle
both columns independently; previously, 0.7
would in some cases silently emit a second SELECT for the
column that was "duped", and in 0.8 an ambiguous column error
would be emitted. The "keys" applied to the .c. collection
of the select() will also be deduped, so that the "column
being replaced" warning will no longer emit for any select()
that specifies use_labels, though the dupe key will be given
an anonymous label which isn't generally user-friendly.
[ticket:2702]
Mike Bayer [Tue, 9 Apr 2013 18:21:40 +0000 (14:21 -0400)]
Fixed indirect regression regarding :func:`.has_inherited_table`,
where since it considers the current class' ``__table__``, was
sensitive to when it was called. This is 0.7's behavior also,
but in 0.7 things tended to "work out" within events like
``__mapper_args__()``. :func:`.has_inherited_table` now only
considers superclasses, so should return the same answer
regarding the current class no matter when it's called
(obviously assuming the state of the superclass).
[ticket:2656]
Mike Bayer [Tue, 9 Apr 2013 15:52:21 +0000 (11:52 -0400)]
Fixed bug when a query of the form:
``query(SubClass).options(subqueryload(Baseclass.attrname))``,
where ``SubClass`` is a joined inh of ``BaseClass``,
would fail to apply the ``JOIN`` inside the subquery
on the attribute load, producing a cartesian product.
The populated results still tended to be correct as additional
rows are just ignored, so this issue may be present as a
performance degradation in applications that are
otherwise working correctly. [ticket:2699]
Mike Bayer [Mon, 1 Apr 2013 17:37:35 +0000 (13:37 -0400)]
- Fixed bug in unit of work whereby a joined-inheritance
subclass could insert the row for the "sub" table
before the parent table, if the two tables had no
ForeignKey constraints set up between them.
Also in 0.7.11. [ticket:2689]
- fix a glitch in the assertsql.CompiledSQL fixture regarding
when a multiparam compiledSQL is used within an AllOf
- add a new utility function randomize_unitofwork() which
does the function of --reversetop
Mike Bayer [Sun, 24 Mar 2013 18:31:48 +0000 (14:31 -0400)]
- add an event to testing so that other dialects can intercept "test_needs_autoincrement"
- get the assumption of "1" for "first sequence item" to be dialect configured
Mike Bayer [Sun, 24 Mar 2013 17:50:56 +0000 (13:50 -0400)]
Loosened the check on dialect-specific argument names
passed to Table(); since we want to support external dialects
and also want to support args without a certain dialect
being installed, it only checks the format of the arg now,
rather than looking for that dialect in sqlalchemy.dialects.
Mike Bayer [Sat, 23 Mar 2013 23:00:11 +0000 (19:00 -0400)]
Fixed bug whereby a DBAPI that can return "0"
for cursor.lastrowid would not function correctly
in conjunction with :attr:`.ResultProxy.inserted_primary_key`.
Ben Trofatter [Tue, 19 Mar 2013 00:58:41 +0000 (17:58 -0700)]
Added workaround for pymysql3 double wrapping ProgrammingErrors to pymysql dialect.
Added workaround for pymysql3 return a bytes object when queried for isolation level.