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.
Mike Bayer [Mon, 5 Sep 2011 23:12:12 +0000 (19:12 -0400)]
- Fixed bug regarding calculation of "from" list
for a select() element. The "from" calc is now
delayed, so that if the construct uses a Column
object that is not yet attached to a Table,
but is later associated with a Table, it generates
SQL using the table as a FROM. This change
impacted fairly deeply the mechanics of how
the FROM list as well as the "correlates" collection
is calculated, as some "clause adaption" schemes
(these are used very heavily in the ORM)
were relying upon the fact that the "froms"
collection would typically be cached before the
adaption completed. The rework allows it
such that the "froms" collection can be cleared
and re-generated at any time. [ticket:2261]
- RelationshipProperty.Comparator._criterion_exists()
adds an "_orm_adapt" annotation to the correlates target,
to work with the change in [ticket:2261]. It's not clear
if the change to correlation+adaption mechanics will affect end user
code yet.
- FromClause now uses group_expirable_memoized_property for
late-generated values like primary key, _columns, etc.
The Select class adds some tokens to this object and has the
nice effect that FromClause doesn't need to know about
Select's names anymore. An additional change might be to
have Select use a different group_expirable_memoized_property
so that it's collection of attribute names are specific to
Select though this isn't really necessary right now.
Mike Bayer [Mon, 22 Aug 2011 15:12:36 +0000 (11:12 -0400)]
- Improvement to multi-param statement logging,
long lists of bound parameter sets will be
compressed with an informative indicator
of the compression taking place. Exception
messages use the same improved formatting.
[ticket:2243]
Mike Bayer [Tue, 16 Aug 2011 22:31:49 +0000 (18:31 -0400)]
- Extra keyword arguments to the base Float
type beyond "precision" and "asdecimal" are ignored;
added a deprecation warning here and additional
docs, related to [ticket:2258]
Mike Bayer [Sun, 14 Aug 2011 16:20:54 +0000 (12:20 -0400)]
- Added a slightly nicer __repr__() to SchemaItem
classes. Note the repr here can't fully support
the "repr is the constructor" idea since schema
items can be very deeply nested/cyclical, have
late initialization of some things, etc.
[ticket:2223]
Mike Bayer [Sun, 14 Aug 2011 15:55:32 +0000 (11:55 -0400)]
- The recreate() method in all pool classes uses
self.__class__ to get at the type of pool
to produce, in the case of subclassing. Note
there's no usual need to subclass pools.
[ticket:2254]
Mike Bayer [Sat, 13 Aug 2011 02:48:40 +0000 (22:48 -0400)]
- add test profiling merge() behavior when merging lots of bidirectional collections/m2os,
collections present in given merge field. This shows that the change proposed
in [ticket:2221] adds over 10% method call overhead including significantly more
SQL statements.
Mike Bayer [Tue, 9 Aug 2011 23:45:20 +0000 (19:45 -0400)]
- Narrowed the assumption made when reflecting
a foreign-key referenced table with schema in
the current search path; an explicit schema will
be applied to the referenced table only if
it actually matches that of the referencing table,
which also has an explicit schema. Previously
it was assumed that "current" schema was synonymous
with the full search_path. [ticket:2249]
Mike Bayer [Sun, 7 Aug 2011 23:04:10 +0000 (19:04 -0400)]
- basic relational patterns -> all declarative. classical mapper folks can
figure it out.
- update self-referential examples to be fully declarative/aliased etc.
Mike Bayer [Sat, 6 Aug 2011 23:30:34 +0000 (19:30 -0400)]
- Repaired edge case where mapper would fail
to fully update internal state when a relationship
on a new mapper would establish a backref on the
first mapper.
- continuing with tutorial, moving eager loading into its
own place and describing more fully
Mike Bayer [Sat, 6 Aug 2011 19:03:33 +0000 (15:03 -0400)]
- Query will convert an OFFSET of zero when
slicing into None, so that needless OFFSET
clauses are not invoked.
- mssql: "0" is accepted as an argument for limit() which
will produce "TOP 0". [ticket:2222]
- add tests to default compiler test for LIMIT/OFFSET generation
Mike Bayer [Sat, 6 Aug 2011 18:23:07 +0000 (14:23 -0400)]
- Fixed bug in query.join() which would occur
in a complex multiple-overlapping path scenario,
where the same table could be joined to
twice. Thanks *much* to Dave Vitek
for the excellent fix here. [ticket:2247]
Mike Bayer [Sat, 6 Aug 2011 01:29:21 +0000 (21:29 -0400)]
- rewrite the docs for association proxy using declarative, add new examples, querying,
etc., part of [ticket:2246]
- add some accessors to AssociationProxy for attributes, test in join(), [ticket:2236]
- update relationship docs to talk about callables, part of [ticket:2246]
Mike Bayer [Thu, 4 Aug 2011 19:34:24 +0000 (15:34 -0400)]
- Ensured that the same ValueError is raised for
illegal date/time/datetime string parsed from
the database regardless of whether C
extensions are in use or not.
Mike Bayer [Mon, 1 Aug 2011 18:16:46 +0000 (14:16 -0400)]
- Added after_soft_rollback() Session event. This
event fires unconditionally whenever rollback()
is called, regardless of if an actual DBAPI
level rollback occurred. This event
is specifically designed to allow operations
with the Session to proceed after a rollback
when the Session.is_active is True.
[ticket:2241]
- SessionTransaction is mentioned in public docs, many
more docstrings for events etc. otherwise