Mike Bayer [Sat, 29 Jun 2013 03:53:27 +0000 (23:53 -0400)]
The behavior of :func:`.extract` has been simplified on the
Postgresql dialect to no longer inject a hardcoded ``::timestamp``
or similar cast into the given expression, as this interfered
with types such as timezone-aware datetimes, but also
does not appear to be at all necessary with modern versions
of psycopg2. Also in 0.8.2.
[ticket:2740]
Mike Bayer [Fri, 28 Jun 2013 15:49:41 +0000 (11:49 -0400)]
Type lookup when reflecting the Firebird types LONG and
INT64 has been fixed so that LONG is treated as INTEGER,
INT64 treated as BIGINT, unless the type has a "precision"
in which case it's treated as NUMERIC. Patch courtesy
Russell Stuart.
[ticket:2757]
Mike Bayer [Fri, 28 Jun 2013 15:35:57 +0000 (11:35 -0400)]
Fixed bug in HSTORE type where keys/values that contained
backslashed quotes would not be escaped correctly when
using the "non native" (i.e. non-psycopg2) means
of translating HSTORE data. Patch courtesy Ryan Kelly.
[ticket:2766]
Mike Bayer [Thu, 27 Jun 2013 20:43:01 +0000 (16:43 -0400)]
- fix a regression caused by #2587, where query.join() would apply an
adapter to an aliased-mapped, non-polymorphic selectable that prevented us from referring
directly to that selectable.
Mike Bayer [Tue, 25 Jun 2013 21:32:51 +0000 (17:32 -0400)]
- rework of correlation, continuing on #2668, #2746
- add support for correlations to propagate all the way in; because
correlations require context now, need to make sure a select enclosure
of any level takes effect any number of levels deep.
- fix what we said correlate_except() was supposed to do when we first
released #2668 - "the FROM clause is left intact if the correlated SELECT
is not used in the context of an enclosing SELECT..." - it was not
considering the "existing_froms" collection at all, and prohibited
additional FROMs from being placed in an any() or has().
- add test for multilevel any()
- lots of docs, including glossary entries as we really need to define
"WHERE clause", "columns clause" etc. so that we can explain correlation better
- based on the insight that a SELECT can correlate anything that ultimately
came from an enclosing SELECT that links to this one via WHERE/columns/HAVING/ORDER BY,
have the compiler keep track of the FROM lists that correspond in this way,
link it to the asfrom flag, so that we send to _get_display_froms() the exact
list of candidate FROMs to correlate. no longer need any asfrom logic in the
Select() itself
- preserve 0.8.1's behavior for correlation when no correlate options are given, not
to mention 0.7 and prior's behavior of not propagating implicit correlation more than one level..
this is to reduce surprises/hard-to-debug situations when a user isn't trying
to correlate anything.
Mike Bayer [Sun, 23 Jun 2013 18:03:47 +0000 (14:03 -0400)]
The resolution of :class:`.ForeignKey` objects to their
target :class:`.Column` has been reworked to be as
immediate as possible, based on the moment that the
target :class:`.Column` is associated with the same
:class:`.MetaData` as this :class:`.ForeignKey`, rather
than waiting for the first time a join is constructed,
or similar. This along with other improvements allows
earlier detection of some foreign key configuration
issues. Also included here is a rework of the
type-propagation system, so that
it should be reliable now to set the type as ``None``
on any :class:`.Column` that refers to another via
:class:`.ForeignKey` - the type will be copied from the
target column as soon as that other column is associated,
and now works for composite foreign keys as well.
[ticket:1765]
Roman Podolyaka [Sat, 22 Jun 2013 10:31:51 +0000 (13:31 +0300)]
Fix unique constraints reflection in SQLite
If SQLite keywords are used as column names, they are
quoted. The code parsing the information about table
unique constraints should be modified so that it properly
removes double-quotes from column names.
Mike Bayer [Sat, 22 Jun 2013 16:19:41 +0000 (12:19 -0400)]
Provided a new attribute for :class:`.TypeDecorator`
called :attr:`.TypeDecorator.coerce_to_is_types`,
to make it easier to control how comparisons using
``==`` or ``!=`` to ``None`` and boolean types goes
about producing an ``IS`` expression, or a plain
equality expression with a bound parameter.
[ticket:2744]
Mike Bayer [Sat, 22 Jun 2013 15:25:41 +0000 (11:25 -0400)]
this locale is not needed. maybe it is somewhere but the locale I have ("C", whatever that means,
cannot find meaning of this anywhere in Postgresql documentation) seems to work
Mike Bayer [Mon, 17 Jun 2013 22:48:17 +0000 (18:48 -0400)]
- rework PropComparator.adapted() to be PropComparator.adapt_to_entity(),
passes in AliasedInsp and allows more flexibility.
- rework the AliasedClass/AliasedInsp relationship so that AliasedInsp has
all state and functionality. AliasedClass is just a facade.
[ticket:2756]
Mike Bayer [Mon, 17 Jun 2013 03:09:31 +0000 (23:09 -0400)]
- clean up this test (really we don't even need this, it's not testing much)
- for the moment, put a catch in it to see if we can trap that issue
on jenkins
Mike Bayer [Sat, 15 Jun 2013 19:20:48 +0000 (15:20 -0400)]
Fixed bug in polymorphic SQL generation where multiple joined-inheritance
entities against the same base class joined to each other as well
would not track columns on the base table independently of each other if
the string of joins were more than two entities long. Also in 0.8.2.
[ticket:2759]
Matt Chisholm [Sat, 15 Jun 2013 16:15:29 +0000 (18:15 +0200)]
don't create a history entry when an object in a backref has changed
The code that determines whether an object in a relation has been added/removed does not take into account that that relation may be a backref. If the relation is a backref, then nothing on the current table is changing, and therefore no history entry should be created.
Mike Bayer [Mon, 10 Jun 2013 17:50:06 +0000 (13:50 -0400)]
Fixed bug where sending a composite attribute into :meth:`.Query.order_by`
would produce a parenthesized expression not accepted by some databases.
[ticket:2754]
Mike Bayer [Mon, 10 Jun 2013 17:45:19 +0000 (13:45 -0400)]
Fixed the interaction between composite attributes and
the :func:`.aliased` function. Previously, composite attributes
wouldn't work correctly in comparison operations when aliasing
was applied. Also in 0.8.2. [ticket:2755]
Mike Bayer [Sun, 9 Jun 2013 21:54:11 +0000 (17:54 -0400)]
- get_unique_constraints() pull request
- version (0.9 for now)
- changelog
- move the test into the test suite so that all dialects can take advantage of it
Roman Podolyaka [Sun, 9 Jun 2013 16:07:00 +0000 (19:07 +0300)]
Add basic support of unique constraints reflection
Inspection API already supports reflection of table
indexes information and those also include unique
constraints (at least for PostgreSQL and MySQL).
But it could be actually useful to distinguish between
indexes and plain unique constraints (though both are
implemented in the same way internally in RDBMS).
This change adds a new method to Inspection API - get_unique_constraints()
and implements it for SQLite, PostgreSQL and MySQL dialects.
Roman Podolyaka [Sat, 8 Jun 2013 17:38:02 +0000 (20:38 +0300)]
Fix using of 'mysql_length' for composite indexes
Currently, one can specify the prefix length for an index
column using 'mysql_length' keyword argument when creating
an Index instance. But in case of composite indexes the
prefix length value is applied only to the last column.
Extend the existing API in way so that 'mysql_length' argument
value can be either:
- an integer specifying the same prefix length value
for each column of an index
- a (column_name --> integer value) mapping specifying
the prefix length value for each column of an index
separately
Mike Bayer [Sat, 8 Jun 2013 17:23:15 +0000 (13:23 -0400)]
Added additional criterion to the ==, != comparators, used with
scalar values, for comparisons to None to also take into account
the association record itself being non-present, in addition to the
existing test for the scalar endpoint on the association record
being NULL. Previously, comparing ``Cls.scalar == None`` would return
records for which ``Cls.associated`` were present and
``Cls.associated.scalar`` is None, but not rows for which
``Cls.associated`` is non-present. More significantly, the
inverse operation ``Cls.scalar != None`` *would* return ``Cls``
rows for which ``Cls.associated`` was non-present.
Additionally, added a special use case where you
can call ``Cls.scalar.has()`` with no arguments,
when ``Cls.scalar`` is a column-based value - this returns whether or
not ``Cls.associated`` has any rows present, regardless of whether
or not ``Cls.associated.scalar`` is NULL or not.
[ticket:2751]
Mike Bayer [Sat, 8 Jun 2013 03:04:33 +0000 (23:04 -0400)]
- Fixed an obscure bug where the wrong results would be
fetched when joining/joinedloading across a many-to-many
relationship to a single-table-inheriting
subclass with a specific discriminator value, due to "secondary"
rows that would come back. The "secondary" and right-side
tables are now inner joined inside of parenthesis for all
ORM joins on many-to-many relationships so that the left->right
join can accurately filtered.
[ticket:2369]