Mike Bayer [Tue, 6 Jan 2009 04:30:11 +0000 (04:30 +0000)]
- query.join() raises an error when the target of the join
doesn't match the property-based attribute - while it's
unlikely anyone is doing this, the SQLAlchemy author was
guilty of this particular loosey-goosey behavior.
Michael Trier [Mon, 5 Jan 2009 22:05:51 +0000 (22:05 +0000)]
mssql date / time refactor.
- Added new MSSmallDateTime, MSDateTime2, MSDateTimeOffset, MSTime types
- Refactored the Date/Time types. The smalldatetime data type no longer
truncates to a date only, and will now be mapped to the MSSmallDateTime
type. Closes #1254.
Mike Bayer [Mon, 5 Jan 2009 19:23:56 +0000 (19:23 +0000)]
- property.of_type() is now recognized on a single-table
inheriting target, when used in the context of
prop.of_type(..).any()/has(), as well as
query.join(prop.of_type(...)).
Mike Bayer [Mon, 5 Jan 2009 15:34:09 +0000 (15:34 +0000)]
- Generalized the IdentityManagedState._instance_dict() callable
to the IdentityMap class so that Weak/StrongInstanceDict both
have the same behavior wrt the state referencing the map
- Fixed bug when using weak_instance_map=False where modified
events would not be intercepted for a flush(). [ticket:1272]
Mike Bayer [Sat, 3 Jan 2009 22:15:38 +0000 (22:15 +0000)]
added teardown_instance() to complement setup_instance().
Based on the instance/class agnostic behavior of ClassManager, this might be the best we can
do regarding [ticket:860]
Mike Bayer [Sat, 3 Jan 2009 20:52:34 +0000 (20:52 +0000)]
- query.order_by() accepts None which will remove any pending
order_by state from the query, as well as cancel out any
mapper/relation configured ordering. This is primarily useful
for overriding the ordering specified on a dynamic_loader().
[ticket:1079]
Michael Trier [Sat, 3 Jan 2009 03:59:49 +0000 (03:59 +0000)]
Excluded another failing test from the mssql dialect.
MSSQL doesn't allow ON UPDATE for self-referential keys. The tree of cascading
referential actions must only have one path to a particular table on the
cascading referential actions tree.
Mike Bayer [Sat, 3 Jan 2009 02:42:34 +0000 (02:42 +0000)]
- Fixed some deep "column correspondence" issues which could
impact a Query made against a selectable containing
multiple versions of the same table, as well as
unions and similar which contained the same table columns
in different column positions at different levels.
[ticket:1268]
Mike Bayer [Fri, 2 Jan 2009 21:24:17 +0000 (21:24 +0000)]
- mysql, postgres: "%" signs in text() constructs are automatically escaped to "%%".
Because of the backwards incompatible nature of this change,
a warning is emitted if '%%' is detected in the string. [ticket:1267]
Mike Bayer [Fri, 2 Jan 2009 19:45:05 +0000 (19:45 +0000)]
- sqlalchemy.sql.expression.Function is now a public
class. It can be subclassed to provide user-defined
SQL functions in an imperative style, including
with pre-established behaviors. The postgis.py
example illustrates one usage of this.
Mike Bayer [Fri, 2 Jan 2009 18:22:50 +0000 (18:22 +0000)]
- Custom comparator classes used in conjunction with
column_property(), relation() etc. can define
new comparison methods on the Comparator, which will
become available via __getattr__() on the
InstrumentedAttribute. In the case of synonym()
or comparable_property(), attributes are resolved first
on the user-defined descriptor, then on the user-defined
comparator.
Mike Bayer [Sun, 28 Dec 2008 22:32:04 +0000 (22:32 +0000)]
- Added OracleNVarchar type, produces NVARCHAR2, and also
subclasses Unicode so that convert_unicode=True by default.
NVARCHAR2 reflects into this type automatically so
these columns pass unicode on a reflected table with no explicit
convert_unicode=True flags. [ticket:1233]
Mike Bayer [Sun, 28 Dec 2008 21:48:12 +0000 (21:48 +0000)]
- Can pass mapped attributes and column objects as keys
to query.update({}). [ticket:1262]
- Mapped attributes passed to the values() of an
expression level insert() or update() will use the
keys of the mapped columns, not that of the mapped
attribute.
Michael Trier [Sun, 28 Dec 2008 21:07:57 +0000 (21:07 +0000)]
Added in a new MSGenericBinary type.
This maps to the Binary type so it can implement the specialized behavior of
treating length specified types as fixed-width Binary types and non-length
types as an unbound variable length Binary type.
Michael Trier [Sun, 28 Dec 2008 01:46:44 +0000 (01:46 +0000)]
MSSQL refactoring of BINARY type and addition of MSVarBinary and MSImage.
- Added in new types: MSVarBinary and MSImage
- Modified MSBinary to now return BINARY instead of IMAGE. This is a
backwards incompatible change. Closes #1249.
Mike Bayer [Sat, 27 Dec 2008 18:45:41 +0000 (18:45 +0000)]
- Added a mutex for the initial pool creation when
using pool.manage(dbapi). This prevents a minor
case of "dogpile" behavior which would otherwise
occur upon a heavy load startup. [ticket:799]
Mike Bayer [Fri, 26 Dec 2008 05:28:38 +0000 (05:28 +0000)]
- Reflected foreign keys will properly locate
their referenced column, even if the column
was given a "key" attribute different from
the reflected name. This is achieved via a
new flag on ForeignKey/ForeignKeyConstraint
called "link_to_name", if True means the given
name is the referred-to column's name, not its
assigned key.
[ticket:650]
- removed column types from sqlite doc, we
aren't going to list out "implementation" types
since they aren't significant and are less present
in 0.6
- mysql will report on missing reflected foreign
key targets in the same way as other dialects
(we can improve that to be immediate within
reflecttable(), but it should be within
ForeignKeyConstraint()).
- postgres dialect can reflect table with
an include_columns list that doesn't include
one or more primary key columns
Mike Bayer [Wed, 24 Dec 2008 04:47:06 +0000 (04:47 +0000)]
- Exceptions raised during compile_mappers() are now
preserved to provide "sticky behavior" - if a hasattr()
call on a pre-compiled mapped attribute triggers a failing
compile and suppresses the exception, subsequent compilation
is blocked and the exception will be reiterated on the
next compile() call. This issue occurs frequently
when using declarative.
Michael Trier [Mon, 22 Dec 2008 20:20:55 +0000 (20:20 +0000)]
Major refactoring of the MSSQL dialect. Thanks zzzeek.
Includes simplifying the IDENTITY handling and the exception handling. Also
includes a cleanup of the connection string handling for pyodbc to favor
the DSN syntax.
Mike Bayer [Thu, 18 Dec 2008 18:11:12 +0000 (18:11 +0000)]
merge the test/ directory from -r5438:5439 of py3k_warnings branch. this gives
us a 2.5-frozen copy of unittest so we're insulated from unittest changes.
Mike Bayer [Thu, 18 Dec 2008 17:57:15 +0000 (17:57 +0000)]
merged -r5299:5438 of py3k warnings branch. this fixes some sqlite py2.6 testing issues,
and also addresses a significant chunk of py3k deprecations. It's mainly
expicit __hash__ methods. Additionally, most usage of sets/dicts to store columns uses
util-based placeholder names.
Mike Bayer [Thu, 18 Dec 2008 16:50:49 +0000 (16:50 +0000)]
- Query() can be passed a "composite" attribute
as a column expression and it will be expanded.
Somewhat related to [ticket:1253].
- Query() is a little more robust when passed
various column expressions such as strings,
clauselists, text() constructs (which may mean
it just raises an error more nicely).
- select() can accept a ClauseList as a column
in the same way as a Table or other selectable
and the interior expressions will be used as
column elements. [ticket:1253]
- removed erroneous FooTest from test/orm/query
-This line, and those below, will be ignored--
M test/orm/query.py
M test/orm/mapper.py
M test/sql/select.py
M lib/sqlalchemy/orm/query.py
M lib/sqlalchemy/sql/expression.py
M CHANGES
Mike Bayer [Wed, 17 Dec 2008 23:09:51 +0000 (23:09 +0000)]
- _execute_clauseelement() goes back to being
a private method. Subclassing Connection
is not needed now that ConnectionProxy
is available.
- tightened the interface for the various _execute_XXX()
methods to reduce ambiguity
- __distill_params() no longer creates artificial [{}] entry,
blank dict is no longer passed through to do_execute()
in any case unless explicitly sent from the outside
as in connection.execute("somestring"), {})
- fixed a few old sql.query tests which were doing that
- removed needless do_execute() from mysql dialect
- fixed charset param not properly being sent to
_compat_fetchone() in mysql