Mike Bayer [Fri, 26 Feb 2010 17:50:34 +0000 (17:50 +0000)]
- the "scale" argument of the Numeric() type is honored when
coercing a returned floating point value into a string
on its way to Decimal - this allows accuracy to function
on SQLite, MySQL. [ticket:1717]
Mike Bayer [Thu, 25 Feb 2010 23:15:39 +0000 (23:15 +0000)]
- merge -r6823:6841 of branches/chrisw_mixin
- declarative now accepts mixin classes directly, as a means
to provide common functional and column-based elements on
all subclasses, as well as a means to propagate a fixed
set of __table_args__ or __mapper_args__ to subclasses.
For custom combinations of __table_args__/__mapper_args__ from
an inherited mixin to local, descriptors can now be used.
New details are all up in the Declarative documentation.
Thanks to Chris Withers for putting up with my strife
on this. [ticket:1707]
Mike Bayer [Thu, 25 Feb 2010 22:16:34 +0000 (22:16 +0000)]
- walk back r6851 slightly. Still emit a warning when the Unicode or UnicodeText type
is passed a bytestring even if the backend accepts unicodes directly.
Mike Bayer [Thu, 25 Feb 2010 22:00:58 +0000 (22:00 +0000)]
- The assert_unicode flag is deprecated. SQLAlchemy will raise
a warning in all cases where it is asked to encode a non-unicode
Python string, and will do nothing for DBAPIs that already
accept Python unicode objects.
Mike Bayer [Wed, 24 Feb 2010 00:43:09 +0000 (00:43 +0000)]
- A major fix in query.join(), when the "on" clause is an
attribute of an aliased() construct, but there is already
an existing join made out to a compatible target, query properly
joins to the right aliased() construct instead of sticking
onto the right side of the existing join. [ticket:1706]
Mike Bayer [Tue, 23 Feb 2010 22:15:09 +0000 (22:15 +0000)]
- "out" parameters require a type that is supported by
cx_oracle. An error will be raised if no cx_oracle
type can be found.
- Column() requires a type if it has no foreign keys (this is
not new). An error is now raised if a Column() has no type
and no foreign keys. [ticket:1705]
Mike Bayer [Tue, 23 Feb 2010 19:53:07 +0000 (19:53 +0000)]
- Added "unicode_errors" parameter to String, Unicode, etc.
Behaves like the 'errors' keyword argument to
the standard library's string.decode() functions. This flag
requires that `convert_unicode` is set to `"force"` - otherwise,
SQLAlchemy is not guaranteed to handle the task of unicode
conversion. Note that this flag adds significant performance
overhead to row-fetching operations for backends that already
return unicode objects natively (which most DBAPIs do). This
flag should only be used as an absolute last resort for reading
strings from a column with varied or corrupted encodings,
which only applies to databases that accept invalid encodings
in the first place (i.e. MySQL. *not* PG, Sqlite, etc.)
Mike Bayer [Tue, 23 Feb 2010 00:57:08 +0000 (00:57 +0000)]
- a change to the previous __mapper_args__ commit.
- the __mapper_args__ dict is copied when propagating to a subclass,
and is taken straight off the class __dict__ to avoid any
propagation from the parent. mapper inheritance already
propagates the things you want from the parent mapper.
[ticket:1393]
Mike Bayer [Tue, 23 Feb 2010 00:39:35 +0000 (00:39 +0000)]
- the __mapper_args__ dict is copied when propagating to a subclass.
Still need to decide how the argument propagation should
work in the bigger picture. [ticket:1393]
Mike Bayer [Tue, 23 Feb 2010 00:35:56 +0000 (00:35 +0000)]
- session.merge() will not expire existing scalar attributes
on an existing target if the target has a value for that
attribute, even if the incoming merged doesn't have
a value for the attribute. This prevents unnecessary loads
on existing items. Will still mark the attr as expired
if the destination doesn't have the attr, though, which
fulfills some contracts of deferred cols. [ticket:1681]
- session.merge() works with relations that specifically
don't include "merge" in their cascade options - the target
is ignored completely.
Michael Trier [Tue, 23 Feb 2010 00:27:34 +0000 (00:27 +0000)]
Modified unittests docs to explain that --first-package-wins=True is required on Windows. Also modified the setup.cfg to add this option so that if using the default config there will be consistent behavior on all platforms.
Mike Bayer [Mon, 22 Feb 2010 23:53:35 +0000 (23:53 +0000)]
- The "allow_null_pks" flag is now called "allow_partial_pks",
defaults to True, acts like it did in 0.5 again. Except,
it also is implemented within merge() such that a SELECT
won't be issued for an incoming instance with partially
NULL primary key if the flag is False. [ticket:1680]
Mike Bayer [Mon, 22 Feb 2010 22:31:49 +0000 (22:31 +0000)]
- DeclarativeMeta exclusively uses cls.__dict__ (not dict_)
as the source of class information; _as_declarative exclusively
uses the dict_ passed to it as the source of class information
(which when using DeclarativeMeta is cls.__dict__). This should
in theory make it easier for custom metaclasses to modify
the state passed into _as_declarative.
Mike Bayer [Mon, 22 Feb 2010 20:37:44 +0000 (20:37 +0000)]
- added util.portable_instancemethod to provide a quick way to make an instancemethod "serializable"
- SchemaType and subclasses Boolean, Enum are now serializable,
including their ddl listener and other event callables.
[ticket:1694] [ticket:1698]
- AddConstraint/DropConstraint use the wrapper for _create_rule
- added test coverage for AddConstraint override of _create_rule
Mike Bayer [Mon, 22 Feb 2010 19:28:25 +0000 (19:28 +0000)]
- Composite PK table on InnoDB where the "autoincrement" column
isn't first will emit an explicit "KEY" phrase within
CREATE TABLE thereby avoiding errors, [ticket:1496]
Mike Bayer [Tue, 16 Feb 2010 19:47:54 +0000 (19:47 +0000)]
- A change to the solution for [ticket:1579] - an end-user
defined bind parameter name that directly conflicts with
a column-named bind generated directly from the SET or
VALUES clause of an update/insert generates a compile error.
This reduces call counts and eliminates some cases where
undesirable name conflicts could still occur.
Mike Bayer [Sun, 14 Feb 2010 19:23:35 +0000 (19:23 +0000)]
- query.one() no longer applies LIMIT to the query, this to
ensure that it fully counts all object identities present
in the result, even in the case where joins may conceal
multiple identities for two or more rows. As a bonus,
one() can now also be called with a query that issued
from_statement() to start with since it no longer modifies
the query. [ticket:1688]
Gaëtan de Menten [Sat, 13 Feb 2010 22:53:39 +0000 (22:53 +0000)]
- Added an optional C extension to speed up the sql layer by
reimplementing the highest impact functions.
The actual speedups will depend heavily on your DBAPI and
the mix of datatypes used in your tables, and can vary from
a 50% improvement to more than 200%. It also provides a modest
(~20%) indirect improvement to ORM speed for large queries.
Note that it is *not* built/installed by default.
See README for installation instructions.
- The most common result processors conversion function were
moved to the new "processors" module. Dialect authors are
encouraged to use those functions whenever they correspond
to their needs instead of implementing custom ones.
Mike Bayer [Sat, 13 Feb 2010 21:16:08 +0000 (21:16 +0000)]
- reduced a bit of overhead in attribute expiration, particularly
the version called by column loaders on an incomplete row (i.e.
joined table inheritance). there are more dramatic changes
that can be made here but this one is conservative so far
as far as how much we're altering how InstanceState tracks
"expired" attributes.
Mike Bayer [Sat, 13 Feb 2010 19:27:14 +0000 (19:27 +0000)]
- For those who might use debug logging on
sqlalchemy.orm.strategies, most logging calls during row
loading have been removed. These were never very helpful
and cluttered up the code.
- Some internal streamlining of object loading grants a
small speedup for large results, estimates are around
10-15%.
Mike Bayer [Sat, 13 Feb 2010 01:42:52 +0000 (01:42 +0000)]
- Improved the installation/test setup regarding Python 3,
now that Distribute runs on Py3k. distribute_setup.py
is now included. See README.py3k for Python 3 installation/
testing instructions.
Mike Bayer [Fri, 12 Feb 2010 21:43:19 +0000 (21:43 +0000)]
- Changed the beaker cache example a bit to have a separate
RelationCache option for lazyload caching. This object
does a lookup among any number of potential attributes
more efficiently by grouping several into a common structure.
Both FromCache and RelationCache are simpler individually.
Mike Bayer [Fri, 12 Feb 2010 19:54:49 +0000 (19:54 +0000)]
- Made sqlalchemy.sql.expressions.Executable part of public
API, used for any expression construct that can be sent to
execute(). FunctionElement now inherits Executable so that
it gains execution_options(), which are also propagated
to the select() that's generated within execute().
Executable in turn subclasses _Generative which marks
any ClauseElement that supports the @_generative
decorator - these may also become "public" for the benefit
of the compiler extension at some point.
Mike Bayer [Thu, 11 Feb 2010 19:33:06 +0000 (19:33 +0000)]
- The type/expression system now does a more complete job
of determining the return type from an expression
as well as the adaptation of the Python operator into
a SQL operator, based on the full left/right/operator
of the given expression. In particular
the date/time/interval system created for Postgresql
EXTRACT in [ticket:1647] has now been generalized into
the type system. The previous behavior which often
occured of an expression "column + literal" forcing
the type of "literal" to be the same as that of "column"
will now usually not occur - the type of
"literal" is first derived from the Python type of the
literal, assuming standard native Python types + date
types, before falling back to that of the known type
on the other side of the expression. Also part
of [ticket:1683].
Mike Bayer [Thu, 11 Feb 2010 02:23:32 +0000 (02:23 +0000)]
- Added "native_datetime=True" flag to create_engine().
This will cause the DATE and TIMESTAMP types to skip
all bind parameter and result row processing, under
the assumption that PARSE_DECLTYPES has been enabled
on the connection. Note that this is not entirely
compatible with the "func.current_date()", which
will be returned as a string. [ticket:1685]