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.
Mike Bayer [Mon, 3 Oct 2011 19:19:07 +0000 (15:19 -0400)]
- a CREATE TABLE will put the COLLATE option
after CHARSET, which appears to be part of
MySQL's arbitrary rules regarding if it will actually
work or not. [ticket:2225]
- reflecting a MySQL table will ensure that the
options added to the Table at the table.kwargs
level have spaces converted to underscores.
This is a slight behavioral change specifically
to the "mysql_default_charset" option which
previously would not be symmetrical.
Mike Bayer [Sun, 2 Oct 2011 21:17:46 +0000 (17:17 -0400)]
- Added "postgresql_using" argument to Index(), produces
USING clause to specify index implementation for
PG. [ticket:2290]. Thanks to Ryan P. Kelly for
the patch.
Mike Bayer [Wed, 28 Sep 2011 17:04:42 +0000 (13:04 -0400)]
- Enhanced the instrumentation in the ORM to support
Py3K's new argument style of "required kw arguments",
i.e. fn(a, b, *, c, d), fn(a, b, *args, c, d).
Argument signatures of mapped object's __init__
method will be preserved, including required kw rules.
[ticket:2237]
Mike Bayer [Mon, 26 Sep 2011 21:58:30 +0000 (17:58 -0400)]
- SQLSoup will not be included in version 0.8
of SQLAlchemy; while useful, we would like to
keep SQLAlchemy itself focused on one ORM
usage paradigm. SQLSoup will hopefully
soon be superseded by a third party
project. [ticket:2262]
Mike Bayer [Sat, 24 Sep 2011 15:12:34 +0000 (11:12 -0400)]
- When an open Session is garbage collected, the objects
within it which remain are considered detached again
when they are add()-ed to a new Session.
This is accomplished by an extra check that the previous
"session_key" doesn't actually exist among the pool
of Sessions. [ticket:2281]
Mike Bayer [Sat, 24 Sep 2011 15:02:29 +0000 (11:02 -0400)]
- The String type now generates VARCHAR2 on Oracle
which is recommended as the default VARCHAR.
Added an explicit VARCHAR2 and NVARCHAR2 to the Oracle
dialect as well. Using NVARCHAR still generates
"NVARCHAR2" - there is no "NVARCHAR" on Oracle -
this remains a slight breakage of the "uppercase types
always give exactly that" policy. VARCHAR still
generates "VARCHAR", keeping with the policy. If
Oracle were to ever define "VARCHAR" as something
different as they claim (IMHO this will never happen),
the type would be available. [ticket:2252]
Mike Bayer [Sat, 24 Sep 2011 14:32:39 +0000 (10:32 -0400)]
- The integer "id" used to link a mapped instance with
its owning Session is now generated by a sequence
generation function rather than id(Session), to
eliminate the possibility of recycled id() values
causing an incorrect result, no need to check that
object actually in the session. [ticket:2280]
Mike Bayer [Sat, 24 Sep 2011 13:01:31 +0000 (09:01 -0400)]
- The entry point resolution supported by
create_engine() now supports resolution of
individual DBAPI drivers on top of a built-in
or entry point-resolved dialect, using the
standard '+' notation - it's converted to
a '.' before being resolved as an entry
point. [ticket:2286]
Mike Bayer [Sat, 24 Sep 2011 01:56:10 +0000 (21:56 -0400)]
- The behavior of =/!= when comparing a scalar select
to a value will no longer produce IN/NOT IN as of 0.8;
this behavior is a little too heavy handed (use in_() if
you want to emit IN) and now emits a deprecation warning.
To get the 0.8 behavior immediately and remove the warning,
a compiler recipe is given at
http://www.sqlalchemy.org/docs/07/dialects/mssql.html#scalar-select-comparisons
to override the behavior of visit_binary().
[ticket:2277]
Mike Bayer [Sat, 24 Sep 2011 00:51:58 +0000 (20:51 -0400)]
- Modified Column.copy() to use _constructor(),
which defaults to self.__class__, in order to
create the new object. This allows easier support
of subclassing Column. [ticket:2284]
Mike Bayer [Thu, 22 Sep 2011 23:21:39 +0000 (19:21 -0400)]
- Fixed bug in unit of work whereby detection of
"cycles" among classes in highly interlinked patterns
would not produce a deterministic
result; thereby sometimes missing some nodes that
should be considered cycles and causing further
issues down the road. Note this bug is in 0.6
also; not backported at the moment.
[ticket:2282]
Mike Bayer [Wed, 21 Sep 2011 20:56:14 +0000 (16:56 -0400)]
- Adjusted the "importlater" mechanism, which is
used internally to resolve import cycles,
such that the usage of __import__ is completed
when the import of sqlalchemy or sqlalchemy.orm
is done, thereby avoiding any usage of __import__
after the application starts new threads,
fixes [ticket:2279]. Also in 0.6.9.
Mike Bayer [Mon, 19 Sep 2011 20:48:39 +0000 (16:48 -0400)]
- added "adapt_on_names" boolean flag to orm.aliased()
construct. Allows an aliased() construct
to link the ORM entity to a selectable that contains
aggregates or other derived forms of a particular
attribute, provided the name is the same as that
of the entity mapped column.
Mike Bayer [Sun, 18 Sep 2011 19:33:12 +0000 (15:33 -0400)]
- Changes to attempt support of FreeTDS 0.91 with
Pyodbc. This includes that string binds are sent as
Python unicode objects when FreeTDS 0.91 is detected,
and a CAST(? AS NVARCHAR) is used when we detect
for a table. However, I'd continue
to characterize Pyodbc + FreeTDS 0.91 behavior as
pretty crappy, there are still many queries such
as used in reflection which cause a core dump on
Linux, and it is not really usable at all
on OSX, MemoryErrors abound and just plain broken
unicode support. [ticket:2273]
Mike Bayer [Fri, 16 Sep 2011 00:18:26 +0000 (20:18 -0400)]
- Fixed a variety of synonym()-related regressions
from 0.6:
- making a synonym against a synonym now works.
- synonyms made against a relationship() can
be passed to query.join(), options sent
to query.options(), passed by name
to query.with_parent().
- revised the approach taken earlier to just
propagate "property" out from the proxied attr the same
way queryable attribute does.
Mike Bayer [Wed, 14 Sep 2011 15:31:33 +0000 (11:31 -0400)]
- Changed the update() method on association proxy
dictionary to use a duck typing approach, i.e.
checks for "keys", to discern between update({})
and update((a, b)). Previously, passing a
dictionary that had tuples as keys would be misinterpreted
as a sequence. [ticket:2275]
Mike Bayer [Sat, 10 Sep 2011 20:54:23 +0000 (16:54 -0400)]
- New event hook, MapperEvents.after_configured().
Called after a configure() step has completed and
mappers were in fact affected. Theoretically this
event is called once per application, unless new mappings
are constructed after existing ones have been used
already.
- New declarative features:
- __declare_last__() method, establishes an event
listener for the class method that will be called
when mappers are completed with the final "configure"
step.
- __abstract__ flag. The class will not be mapped
at all when this flag is present on the class.
- New helper classes ConcreteBase, AbstractConcreteBase.
Allow concrete mappings using declarative which automatically
set up the "polymorphic_union" when the "configure"
mapper step is invoked.
- The mapper itself has semi-private methods that allow
the "with_polymorphic" selectable to be assigned
to the mapper after it has already been configured.
[ticket:2239]
Mike Bayer [Fri, 9 Sep 2011 21:12:52 +0000 (17:12 -0400)]
- Reflection functions for Table, Sequence no longer
case insensitive. Names can be differ only in case
and will be correctly distinguished. [ticket:2256]
Mike Bayer [Fri, 9 Sep 2011 20:18:44 +0000 (16:18 -0400)]
- Calling class_mapper() and passing in an object
that is not a "type" (i.e. a class that could
potentially be mapped) now raises an informative
ArgumentError, rather than UnmappedClassError.
[ticket:2196]
Mike Bayer [Fri, 9 Sep 2011 20:11:13 +0000 (16:11 -0400)]
- Identity map .discard() uses dict.pop(,None)
internally instead of "del" to avoid KeyError/warning
during a non-determinate gc teardown [ticket:2267]
Mike Bayer [Fri, 9 Sep 2011 20:03:23 +0000 (16:03 -0400)]
- Behavioral improvement: empty
conjunctions such as and_() and or_() will be
flattened in the context of an enclosing conjunction,
i.e. and_(x, or_()) will produce 'X' and not 'X AND
()'. [ticket:2257].
Mike Bayer [Fri, 9 Sep 2011 19:51:40 +0000 (15:51 -0400)]
- Fixed bug whereby if __eq__() was
redefined, a relationship many-to-one lazyload
would hit the __eq__() and fail. [ticket:2260]
Does not apply to 0.6.9.