Mike Bayer [Fri, 9 Dec 2011 16:12:41 +0000 (11:12 -0500)]
- Standalone expressions in polymorphic_on
propagate to single-table inheritance
subclasses so that they are used in the
WHERE /JOIN clause to limit rows to that
subclass as is the usual behavior.
- make sure implicit map to polymorphic_on expr
handles creating a label(). Use an explicit name
here as _sa_polymorphic_on makes more sense when
poking around in _props.
Mike Bayer [Fri, 9 Dec 2011 05:56:12 +0000 (00:56 -0500)]
- [feature] polymorphic_on now accepts many
new kinds of values:
- standalone expressions that aren't
otherwise mapped
- column_property() objects
- string names of any column_property()
or attribute name of a mapped Column
The docs include an example using
the case() construct, which is likely to be
a common constructed used here.
[ticket:2345] and part of [ticket:2238]
Mike Bayer [Wed, 7 Dec 2011 18:24:11 +0000 (13:24 -0500)]
- [bug] Fixed bug in get_history() when referring
to a composite attribute that has no value;
added coverage for get_history() regarding
composites which is otherwise just a userland
function.
Mike Bayer [Wed, 7 Dec 2011 01:59:04 +0000 (20:59 -0500)]
- doc updates per [ticket:2251]
- [feature] Added new value for Column autoincrement
called "ignore_fk", can be used to force autoincrement
on a column that's still part of a ForeignKeyConstraint.
New example in the relationship docs illustrates
its use.
Mike Bayer [Tue, 6 Dec 2011 21:31:52 +0000 (16:31 -0500)]
- [bug] Decode incoming values when retrieving
list of index names and the names of columns
within those indexes. [ticket:2269]
- rewrite unicode reflection test to be of more general use on
broken backends
Mike Bayer [Tue, 6 Dec 2011 20:35:06 +0000 (15:35 -0500)]
- [bug] don't cast "table name" as NVARCHAR
on SQL Server 2000. Still mostly in the dark
what incantations are needed to make PyODBC
work fully with FreeTDS 0.91 here, however.
[ticket:2343]
Mike Bayer [Mon, 5 Dec 2011 22:06:15 +0000 (17:06 -0500)]
- [feature] Added an example to the hybrid docs
of a "transformer" - a hybrid that returns a
query-transforming callable in combination
with a custom comparator. Uses a new method
on Query called with_transformation(). The use
case here is fairly experimental, but only
adds one line of code to Query.
Mike Bayer [Sun, 4 Dec 2011 21:23:55 +0000 (16:23 -0500)]
- [bug] Updated warning message when setting
delete-orphan without delete to no longer
refer to 0.6, as we never got around to
upgrading this to an exception. Ideally
this might be better as an exception but
it's not critical either way. [ticket:2325]
- add new test suite to test_cascades for cascade
arguments
Mike Bayer [Sun, 4 Dec 2011 20:47:13 +0000 (15:47 -0500)]
-re-document the is_modified method, and place significant caveats
about the "passive" flag which is now known to be wrong. Add
new is_modified tests illustrating the passive flag.
[ticket:2320]
Mike Bayer [Sun, 4 Dec 2011 19:25:00 +0000 (14:25 -0500)]
- [bug] Fixed bug whereby transaction.rollback()
would throw an error on an invalidated
connection if the transaction were a
two-phase or savepoint transaction.
For plain transactions, rollback() is a no-op
if the connection is invalidated, so while
it wasn't 100% clear if it should be a no-op,
at least now the interface is consistent.
[ticket:2317]
Mike Bayer [Sun, 4 Dec 2011 19:16:42 +0000 (14:16 -0500)]
- [feature] The "extend_existing" flag on Table
now allows for the reflection process to take
effect for a Table object that's already been
defined; when autoload=True and extend_existing=True
are both set, the full set of columns will be
reflected from the Table which will then
*overwrite* those columns already present,
rather than no activity occurring. Columns that
are present directly in the autoload run
will be used as always, however.
[ticket:1410]
Mike Bayer [Sun, 4 Dec 2011 18:46:45 +0000 (13:46 -0500)]
- [bug] the "name" of a column-level CHECK constraint,
if present, is now rendered in the CREATE TABLE
statement using "CONSTRAINT <name> CHECK <expression>".
[ticket:2305]
Mike Bayer [Sun, 4 Dec 2011 18:29:29 +0000 (13:29 -0500)]
- [bug] pyodbc-based dialects now parse the
pyodbc accurately as far as observed
pyodbc strings, including such gems
as "py3-3.0.1-beta4" [ticket:2318]
- [bug] use new pyodbc version detection for
_need_decimal_fix option, [ticket:2318]
Mike Bayer [Sun, 4 Dec 2011 01:57:27 +0000 (20:57 -0500)]
- [bug] Calls to query.join() to a single-table
inheritance subclass are now tracked, and
are used to eliminate the additional WHERE..
IN criterion normally tacked on with single
table inheritance, since the join should
accommodate it. This allows OUTER JOIN
to a single table subclass to produce
the correct results, and overall will produce
fewer WHERE criterion when dealing with
single table inheritance joins.
[ticket:2328]
Mike Bayer [Sun, 4 Dec 2011 01:04:55 +0000 (20:04 -0500)]
- [bug] repaired the with_hint() feature which
wasn't implemented correctly on MSSQL -
usually used for the "WITH (NOLOCK)" hint
(which you shouldn't be using anyway !
use snapshot isolation instead :) )
[ticket:2336]
Mike Bayer [Sun, 4 Dec 2011 00:50:01 +0000 (19:50 -0500)]
- [bug] Fixed bug whereby column_property() created
against ORM-level column could be treated as
a distinct entity when producing certain
kinds of joined-inh joins. [ticket:2316]
- [bug] related to [ticket:2316], made some
adjustments to the change from [ticket:2261]
regarding the "from" list on a select(). The
_froms collection is no longer memoized, as this
simplifies various use cases and removes the
need for a "warning" if a column is attached
to a table after it was already used in an
expression - the select() construct will now
always produce the correct expression.
There's probably no real-world
performance hit here; select() objects are
almost always made ad-hoc, and systems that
wish to optimize the re-use of a select()
would be using the "compiled_cache" feature.
A hit which would occur when calling select.bind
has been reduced, but the vast majority
of users shouldn't be using "bound metadata"
anyway :).
Mike Bayer [Thu, 1 Dec 2011 19:21:43 +0000 (14:21 -0500)]
- [bug] Fixed bug whereby "order_by='foreign_key'"
option to Inspector.get_table_names
wasn't implementing the sort properly, replaced
with the existing sort algorithm
- clean up metadata usage in reflection tests
Mike Bayer [Tue, 29 Nov 2011 03:28:28 +0000 (22:28 -0500)]
- [feature] Added create_type constructor argument
to pg.ENUM. When False, no CREATE/DROP or
checking for the type will be performed as part
of a table create/drop event; only the
create()/drop)() methods called directly
will do this. Helps with Alembic "offline"
scripts.
Mike Bayer [Mon, 28 Nov 2011 17:44:56 +0000 (12:44 -0500)]
- [bug] Fixed bug whereby TypeDecorator would
return a stale value for _type_affinity, when
using a TypeDecorator that "switches" types,
like the CHAR/UUID type.
Mike Bayer [Thu, 24 Nov 2011 15:47:10 +0000 (10:47 -0500)]
- doc updates in loading
- de-emphasize contains_alias() which is pretty much a non-use case
- add docs for immediateload which have been missing all this time
- fix links, formatting
Mike Bayer [Sun, 20 Nov 2011 04:28:01 +0000 (23:28 -0500)]
- [bug] further tweak to the fix from [ticket:2261],
so that generative methods work a bit better
off of cloned (this is almost a non-use case though).
In particular this allows with_only_columns()
to behave more consistently. Added additional
documentation to with_only_columns() to clarify
expected behavior, which changed as a result
of [ticket:2261]. [ticket:2319]
- document the crap out of with_only_columns, include caveats about
the change, etc.
Mike Bayer [Sun, 13 Nov 2011 19:30:04 +0000 (14:30 -0500)]
- add tests to try to find the case that [ticket:2221] is looking for.
So far, can't find a test where removing that check makes things better.
Easy to find tests where removing it makes things worse.
Mike Bayer [Sun, 30 Oct 2011 19:10:56 +0000 (15:10 -0400)]
- attribute system gets a pop() method.
- remove() on a scalar object will raise if the object
removed is not what was present.
- InstanceState can be pickled if obj() is None; this
to support the other changes in this commit
- only use trackparent flag on attributes if
single_parent or ONETOMANY; otherwise we can skip this
overhead
- attribute hasparent()/sethasparent() check that trackparent
is set, else their usage is invalid
- [bug] Fixed backref behavior when "popping" the
value off of a many-to-one in response to
a removal from a stale one-to-many - the operation
is skipped, since the many-to-one has since
been updated. [ticket:2315]
- [bug] After some years of not doing this, added
more granularity to the "is X a parent of Y"
functionality, which is used when determining
if the FK on "Y" needs to be "nulled out" as well
as if "Y" should be deleted with delete-orphan
cascade. The test now takes into account the
Python identity of the parent as well its identity
key, to see if the last known parent of Y is
definitely X. If a decision
can't be made, a StaleDataError is raised. The
conditions where this error is raised are fairly
rare, requiring that the previous parent was
garbage collected, and previously
could very well inappropriately update/delete
a record that's since moved onto a new parent,
though there may be some cases where
"silent success" occurred previously that will now
raise in the face of ambiguity.
Expiring "Y" resets the "parent" tracker, meaning
X.remove(Y) could then end up deleting Y even
if X is stale, but this is the same behavior
as before; it's advised to expire X also in that
case. [ticket:2264]
Mike Bayer [Sat, 29 Oct 2011 21:38:56 +0000 (17:38 -0400)]
- [bug] Postgresql dialect memoizes that an ENUM of a
particular name was processed
during a create/drop sequence. This allows
a create/drop sequence to work without any
calls to "checkfirst", and also means with
"checkfirst" turned on it only needs to
check for the ENUM once. [ticket:2311]
Mike Bayer [Fri, 28 Oct 2011 21:46:28 +0000 (17:46 -0400)]
- [bug] Fixed bug whereby a subclass of a subclass
using concrete inheritance in conjunction with
the new ConcreteBase or AbstractConcreteBase
would fail to apply the subclasses deeper than
one level to the "polymorphic loader" of each
base [ticket:2312]
- [bug] Fixed bug whereby a subclass of a subclass
using the new AbstractConcreteBase would fail
to acquire the correct "base_mapper" attribute
when the "base" mapper was generated, thereby
causing failures later on. [ticket:2312]
Mike Bayer [Wed, 26 Oct 2011 16:41:18 +0000 (12:41 -0400)]
- [bug] the value of a composite attribute is now
expired after an insert or update operation, instead
of regenerated in place. This ensures that a
column value which is expired within a flush
will be loaded first, before the composite
is regenerated using that value. [ticket:2309]
- [bug] The fix in [ticket:2309] also emits the
"refresh" event when the composite value is
loaded on access, even if all column
values were already present, as is appropriate.
This fixes the "mutable" extension which relies
upon the "load" event to ensure the _parents
dictionary is up to date, fixes [ticket:2308].
Thanks to Scott Torborg for the test case here.
Mike Bayer [Sun, 23 Oct 2011 20:57:48 +0000 (16:57 -0400)]
- [feature] Added new support for remote "schemas":
- MetaData() accepts "schema" and "quote_schema"
arguments, which will be applied to the same-named
arguments of a Table
or Sequence which leaves these at their default
of ``None``.
- Sequence accepts "quote_schema" argument
- tometadata() for Table will use the "schema"
of the incoming MetaData for the new Table
if the schema argument is explicitly "None"
- Added CreateSchema and DropSchema DDL
constructs - these accept just the string
name of a schema and a "quote" flag.
- When using default "schema" with MetaData,
ForeignKey will also assume the "default" schema
when locating remote table. This allows the "schema"
argument on MetaData to be applied to any
set of Table objects that otherwise don't have
a "schema".
- a "has_schema" method has been implemented
on dialect, but only works on Postgresql so far.
Courtesy Manlio Perillo, [ticket:1679]
Mike Bayer [Sun, 23 Oct 2011 17:05:56 +0000 (13:05 -0400)]
- Added accessor to types called "python_type",
returns the rudimentary Python type object
for a particular TypeEngine instance, if known,
else raises NotImplementedError. [ticket:77]
Mike Bayer [Mon, 17 Oct 2011 17:26:26 +0000 (13:26 -0400)]
- Fixed bug in history_meta.py example where
the "unique" flag was not removed from a
single-table-inheritance subclass which
generates columns to put up onto the base.
Mike Bayer [Sat, 15 Oct 2011 19:05:51 +0000 (15:05 -0400)]
- Added client_encoding parameter to create_engine()
when the postgresql+psycopg2 dialect is used;
calls the psycopg2 set_client_encoding() method
with the value upon connect. [ticket:1839]
Mike Bayer [Sat, 15 Oct 2011 16:10:31 +0000 (12:10 -0400)]
- Added an exception catch + warning for the
"return unicode detection" step within connect,
allows databases that crash on NVARCHAR to
continue initializing, assuming no NVARCHAR
type implemented. [ticket:2299]
Mike Bayer [Wed, 12 Oct 2011 19:15:28 +0000 (15:15 -0400)]
- Improved query.join() such that the "left" side
can more flexibly be a non-ORM selectable,
such as a subquery. A selectable placed
in select_from() will now be used as the left
side, favored over implicit usage
of a mapped entity.
If the join still fails based on lack of
foreign keys, the error message includes
this detail. Thanks to brianrhude
on IRC for the test case. [ticket:2298]
Mike Bayer [Tue, 11 Oct 2011 18:15:09 +0000 (14:15 -0400)]
- Added new flag expire_on_flush=False to column_property(),
marks those properties that would otherwise be considered
to be "readonly", i.e. derived from SQL expressions,
to retain their value after a flush has occurred, including
if the parent object itself was involved in an update.
Mike Bayer [Tue, 11 Oct 2011 04:15:43 +0000 (00:15 -0400)]
- adjust some tests and such to work better with a mysql 5.5 install
- Added mysql_length parameter to Index construct,
specifies "length" for indexes. [ticket:2293]
Mike Bayer [Wed, 5 Oct 2011 15:47:19 +0000 (11:47 -0400)]
- Fixed bug related to [ticket:2141] whereby the
same modified index behavior in PG 9 affected
primary key reflection on a renamed column.
[ticket:2291]. Also in 0.6.9.