Mike Bayer [Fri, 25 Oct 2013 23:11:53 +0000 (19:11 -0400)]
- Fixed bug where Oracle table reflection using synonyms would fail
if the synonym and the table were in different remote schemas.
Patch to fix courtesy Kyle Derr. [ticket:2853]
Mike Bayer [Fri, 25 Oct 2013 21:56:53 +0000 (17:56 -0400)]
- catch the metadata on ScalarTest.test_scalar_proxy, this has been leaving itself
around for a long time
- association proxy now returns None for proxied scalar that is also None, rather
than raising AttributeError. [ticket:2810]
Mike Bayer [Fri, 25 Oct 2013 21:18:40 +0000 (17:18 -0400)]
- Fix and test parsing of MySQL foreign key options within reflection;
this complements the work in :ticket:`2183` where we begin to support
reflection of foreign key options such as ON UPDATE/ON DELETE
cascade. [ticket:2839]
Mike Bayer [Fri, 25 Oct 2013 17:13:24 +0000 (13:13 -0400)]
- :func:`.attributes.get_history()` when used with a scalar column-mapped
attribute will now honor the "passive" flag
passed to it; as this defaults to ``PASSIVE_OFF``, the function will
by default query the database if the value is not present.
This is a behavioral change vs. 0.8. [ticket:2787]
- Added new method :meth:`.AttributeState.load_history`, works like
:attr:`.AttributeState.history` but also fires loader callables.
Mike Bayer [Wed, 23 Oct 2013 21:41:55 +0000 (17:41 -0400)]
An overhaul of expression handling for special symbols particularly
with conjunctions, e.g.
``None`` :func:`.expression.null` :func:`.expression.true`
:func:`.expression.false`, including consistency in rendering NULL
in conjunctions, "short-circuiting" of :func:`.and_` and :func:`.or_`
expressions which contain boolean constants, and rendering of
boolean constants and expressions as compared to "1" or "0" for backends
that don't feature ``true``/``false`` constants. [ticket:2804]
Mike Bayer [Tue, 22 Oct 2013 03:28:19 +0000 (23:28 -0400)]
- just comment out this test, we may have to figure out if the whole
"serializer" can just be ditched, or if somehow these deterministic issues
can be fixed (everyone implements __reduce__ maybe?)
Mike Bayer [Mon, 21 Oct 2013 20:49:46 +0000 (16:49 -0400)]
- A :func:`.bindparam` construct with a "null" type (e.g. no type
specified) is now copied when used in a typed expression, and the
new copy is assigned the actual type of the compared column. Previously,
this logic would occur on the given :func:`.bindparam` in place.
Additionally, a similar process now occurs for :func:`.bindparam` constructs
passed to :meth:`.ValuesBase.values` for a :class:`.Insert` or
:class:`.Update` construct. [ticket:2850]
Mike Bayer [Sun, 20 Oct 2013 20:59:56 +0000 (16:59 -0400)]
- The typing system now handles the task of rendering "literal bind" values,
e.g. values that are normally bound parameters but due to context must
be rendered as strings, typically within DDL constructs such as
CHECK constraints and indexes (note that "literal bind" values
become used by DDL as of :ticket:`2742`). A new method
:meth:`.TypeEngine.literal_processor` serves as the base, and
:meth:`.TypeDecorator.process_literal_param` is added to allow wrapping
of a native literal rendering method. [ticket:2838]
- enhance _get_colparams so that we can send flags like literal_binds into
INSERT statements
- add support in PG for inspecting standard_conforming_strings
- add a new series of roundtrip tests based on INSERT of literal plus SELECT
for basic literal rendering in dialect suite
Mike Bayer [Sun, 20 Oct 2013 20:25:46 +0000 (16:25 -0400)]
- add a type_coerce() step within Enum, Boolean to the CHECK constraint,
so that the custom type isn't exposed to an operation that is against the
"impl" type's constraint, [ticket:2842]
- this change showed up as some recursion overflow in pickling with labels,
add a __reduce__() there....pickling of expressions is less and less something
that's very viable...
Mike Bayer [Sat, 19 Oct 2013 00:01:45 +0000 (20:01 -0400)]
- The :meth:`.Table.tometadata` method now produces copies of
all :attr:`.SchemaItem.info` dictionaries from all :class:`.SchemaItem`
objects within the structure including columns, constraints,
foreign keys, etc. As these dictionaries
are copies, they are independent of the original dictionary.
Previously, only the ``.info`` dictionary of :class:`.Column` was transferred
within this operation, and it was only linked in place, not copied.
[ticket:2716]
Mike Bayer [Fri, 18 Oct 2013 23:00:05 +0000 (19:00 -0400)]
- Removed a 128-character truncation from the reflection of the
server default for a column; this code was original from
PG system views which truncated the string for readability.
[ticket:2844]
Mike Bayer [Fri, 18 Oct 2013 18:44:01 +0000 (14:44 -0400)]
- The change in :ticket:`2721`, which is that the ``deferrable`` keyword
of :class:`.ForeignKeyConstraint` is silently ignored on the MySQL
backend, will be reverted as of 0.9; this keyword will now render again, raising
errors on MySQL as it is not understood - the same behavior will also
apply to the ``initially`` keyword. In 0.8, the keywords will remain
ignored but a warning is emitted. Additionally, the ``match`` keyword
now raises a :class:`.CompileError` on 0.9 and emits a warning on 0.8;
this keyword is not only silently ignored by MySQL but also breaks
the ON UPDATE/ON DELETE options.
To use a :class:`.ForeignKeyConstraint`
that does not render or renders differently on MySQL, use a custom
compilation option. An example of this usage has been added to the
documentation, see :ref:`mysql_foreign_keys`.
[ticket:2721] [ticket:2839]
Mike Bayer [Tue, 15 Oct 2013 23:06:21 +0000 (19:06 -0400)]
- Added support for rendering ``SMALLSERIAL`` when a :class:`.SmallInteger`
type is used on a primary key autoincrement column, based on server
version detection of Postgresql version 9.2 or greater.
[ticket:2840]
Mike Bayer [Mon, 14 Oct 2013 20:12:54 +0000 (16:12 -0400)]
The MySQL :class:`.mysql.SET` type now features the same auto-quoting
behavior as that of :class:`.mysql.ENUM`. Quotes are not required when
setting up the value, but quotes that are present will be auto-detected
along with a warning. This also helps with Alembic where
the SET type doesn't render with quotes. [ticket:2817]
Mike Bayer [Mon, 14 Oct 2013 18:53:28 +0000 (14:53 -0400)]
The ``.unique`` flag on :class:`.Index` could be produced as ``None``
if it was generated from a :class:`.Column` that didn't specify ``unique``
(where it defaults to ``None``). The flag will now always be ``True`` or
``False``. [ticket:2825]
Mike Bayer [Sun, 13 Oct 2013 20:42:32 +0000 (16:42 -0400)]
- Added new option to :func:`.relationship` ``distinct_target_key``.
This enables the subquery eager loader strategy to apply a DISTINCT
to the innermost SELECT subquery, to assist in the case where
duplicate rows are generated by the innermost query which corresponds
to this relationship (there's not yet a general solution to the issue
of dupe rows within subquery eager loading, however, when joins outside
of the innermost subquery produce dupes). When the flag
is set to ``True``, the DISTINCT is rendered unconditionally, and when
it is set to ``None``, DISTINCT is rendered if the innermost relationship
targets columns that do not comprise a full primary key.
The option defaults to False in 0.8 (e.g. off by default in all cases),
None in 0.9 (e.g. automatic by default). Thanks to Alexander Koval
for help with this. [ticket:2836]
Mike Bayer [Sun, 13 Oct 2013 18:09:35 +0000 (14:09 -0400)]
MySQL-connector dialect now allows options in the create_engine
query string to override those defaults set up in the connect,
including "buffered" and "raise_on_warnings".
[ticket:2515]
Mike Bayer [Sun, 13 Oct 2013 00:04:55 +0000 (20:04 -0400)]
- Fixed bug in default compiler plus those of postgresql, mysql, and
mssql to ensure that any literal SQL expression values are
rendered directly as literals, instead of as bound parameters,
within a CREATE INDEX statement. [ticket:2742]
- don't need expression_as_ddl(); literal_binds and include_table
take care of this functionality.
Mike Bayer [Fri, 11 Oct 2013 20:41:52 +0000 (16:41 -0400)]
- fix bug due to regression from #2793, make sure we only go to load
scalar attributes here and not relationships, else we get an error if there's no
actual scalars to load
Mike Bayer [Fri, 11 Oct 2013 20:16:08 +0000 (16:16 -0400)]
The ``default`` argument of :class:`.Column` now accepts a class
or object method as an argument, in addition to a standalone function;
will properly detect if the "context" argument is accepted or not.
Mike Bayer [Fri, 11 Oct 2013 19:55:57 +0000 (15:55 -0400)]
The "name" attribute is set on :class:`.Index` before the "attach"
events are called, so that attachment events can be used to dynamically
generate a name for the index based on the parent table and/or
columns. [ticket:2835]
Mike Bayer [Fri, 11 Oct 2013 16:48:46 +0000 (12:48 -0400)]
- The method signature of :meth:`.Dialect.reflecttable`, which in
all known cases is provided by :class:`.DefaultDialect`, has been
tightened to expect ``include_columns`` and ``exclude_columns``
arguments without any kw option, reducing ambiguity - previously
``exclude_columns`` was missing. [ticket:2748]
Mike Bayer [Wed, 9 Oct 2013 00:06:58 +0000 (20:06 -0400)]
A :func:`.select` that is made to refer to itself in its FROM clause,
typically via in-place mutation, will raise an informative error
message rather than causing a recursion overflow.
[ticket:2815]
Mike Bayer [Tue, 8 Oct 2013 23:47:13 +0000 (19:47 -0400)]
Fixed bug where using an annotation such as :func:`.remote` or
:func:`.foreign` on a :class:`.Column` before association with a parent
:class:`.Table` could produce issues related to the parent table not
rendering within joins, due to the inherent copy operation performed
by an annotation. [ticket:2813]
Mike Bayer [Tue, 8 Oct 2013 23:20:09 +0000 (19:20 -0400)]
The erroneous kw arg "schema" has been removed from the :class:`.ForeignKey`
object. this was an accidental commit that did nothing; a warning is raised
in 0.8.3 when this kw arg is used. [ticket:2831]
Mike Bayer [Mon, 7 Oct 2013 00:29:08 +0000 (20:29 -0400)]
- merge ticket_1418 branch, [ticket:1418]
- The system of loader options has been entirely rearchitected to build
upon a much more comprehensive base, the :class:`.Load` object. This
base allows any common loader option like :func:`.joinedload`,
:func:`.defer`, etc. to be used in a "chained" style for the purpose
of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``.
The new system supersedes the usage of dot-separated path names,
multiple attributes within options, and the usage of ``_all()`` options.
- Added a new load option :func:`.orm.load_only`. This allows a series
of column names to be specified as loading "only" those attributes,
deferring the rest.
Mike Bayer [Sun, 6 Oct 2013 03:47:49 +0000 (23:47 -0400)]
- fix propagation of quote flag within _gen_label() so that if the
name is already an instance of _anonymous_label(), we don't downgrade
it to a plain quoted_name - fixes regression from [ticket:2812].
[ticket:2834]
Mike Bayer [Thu, 3 Oct 2013 21:06:55 +0000 (17:06 -0400)]
- A new construct :class:`.Bundle` is added, which allows for specification
of groups of column expressions to a :class:`.Query` construct.
The group of columns are returned as a single tuple by default. The
behavior of :class:`.Bundle` can be overridden however to provide
any sort of result processing to the returned row. One example included
is :attr:`.Composite.Comparator.bundle`, which applies a bundled form
of a "composite" mapped attribute.
[ticket:2824]
- The :func:`.composite` construct now maintains the return object
when used in a column-oriented :class:`.Query`, rather than expanding
out into individual columns. This makes use of the new :class:`.Bundle`
feature internally. This behavior is backwards incompatible; to
select from a composite column which will expand out, use
``MyClass.some_composite.clauses``.
Mike Bayer [Sat, 7 Sep 2013 01:39:36 +0000 (21:39 -0400)]
- modify what we did in [ticket:2793] so that we can also set the
version id programmatically outside of the generator. using this system,
we can also leave the version id alone.
Mike Bayer [Wed, 28 Aug 2013 21:25:44 +0000 (17:25 -0400)]
Fixed bug where using the ``column_reflect`` event to change the ``.key``
of the incoming :class:`.Column` would prevent primary key constraints,
indexes, and foreign key constraints from being correctly reflected.
Also in 0.8.3. [ticket:2811]
Mike Bayer [Wed, 28 Aug 2013 01:37:22 +0000 (21:37 -0400)]
- cx_oracle seems to have a bug here though it is hard to track down
- cx_oracle dialect doesn't use normal col names, lets just not rely on that for now
Mike Bayer [Wed, 28 Aug 2013 00:43:22 +0000 (20:43 -0400)]
- A rework to the way that "quoted" identifiers are handled, in that
instead of relying upon various ``quote=True`` flags being passed around,
these flags are converted into rich string objects with quoting information
included at the point at which they are passed to common schema constructs
like :class:`.Table`, :class:`.Column`, etc. This solves the issue
of various methods that don't correctly honor the "quote" flag such
as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name`
object is a string subclass that can also be used explicitly if needed;
the object will hold onto the quoting preferences passed and will
also bypass the "name normalization" performed by dialects that
standardize on uppercase symbols, such as Oracle, Firebird and DB2.
The upshot is that the "uppercase" backends can now work with force-quoted
names, such as lowercase-quoted names and new reserved words.
[ticket:2812]