Mike Bayer [Mon, 8 Feb 2010 18:37:47 +0000 (18:37 +0000)]
- Query called in the context of an expression will render
disambiguating labels in all cases. Note that this does
not apply to the existing .statement and .subquery()
accessor/method, which still honors the .with_labels()
setting that defaults to False.
- Query.union() retains disambiguating labels within the
returned statement, thus avoiding various SQL composition
errors which can result from column name conflicts.
[ticket:1676]
Mike Bayer [Sun, 7 Feb 2010 23:58:17 +0000 (23:58 +0000)]
- Now uses sqlalchemy.orm.exc.DetachedInstanceError when an
attribute load or refresh action fails due to object
being detached from any Session. UnboundExecutionError
is specific to engines bound to sessions and statements.
Mike Bayer [Sun, 7 Feb 2010 00:56:05 +0000 (00:56 +0000)]
- FunctionElement subclasses are now directly executable the
same way any func.foo() construct is, with automatic
SELECT being applied when passed to execute().
- The "type" and "bind" keyword arguments of a func.foo()
construct are now local to "func." constructs and are
not part of the FunctionElement base class, allowing
a "type" to be handled in a custom constructor or
class-level variable.
Mike Bayer [Fri, 5 Feb 2010 19:16:10 +0000 (19:16 +0000)]
- Slight improvement to the fix for [ticket:1362] to not issue
needless updates of the primary key column during a so-called
"row switch" operation, i.e. add + delete of two objects
with the same PK.
Mike Bayer [Fri, 5 Feb 2010 18:12:38 +0000 (18:12 +0000)]
- Fixed bug in session.rollback() which involved not removing
formerly "pending" objects from the session before
re-integrating "deleted" objects, typically occured with
natural primary keys. If there was a primary key conflict
between them, the attach of the deleted would fail
internally. The formerly "pending" objects are now expunged
first. [ticket:1674]
Mike Bayer [Tue, 2 Feb 2010 23:26:34 +0000 (23:26 +0000)]
the order of rollback()s wasn't correct. slightly disturbing as the test usually passed,
began failing on PG as of somewhat unrelated commit r6705, and only when the full test/engine series
of tests were run. very heisenbuggy. may want to add tests to assert that TLEngine is enforcing
nesting even with subtransactions.
Mike Bayer [Tue, 2 Feb 2010 22:56:19 +0000 (22:56 +0000)]
- Primary key values can now be changed on a joined-table inheritance
object, and ON UPDATE CASCADE will be taken into account when
the flush happens. Set the new "passive_updates" flag to False
on mapper() when using SQLite or MySQL/MyISAM. [ticket:1362]
- flush() now detects when a primary key column was updated by
an ON UPDATE CASCADE operation from another primary key, and
can then locate the row for a subsequent UPDATE on the new PK
value. This occurs when a relation() is there to establish
the relationship as well as passive_updates=True. [ticket:1671]
Mike Bayer [Sat, 30 Jan 2010 18:28:37 +0000 (18:28 +0000)]
- the "save-update" cascade will now cascade the pending *removed*
values from a scalar or collection attribute into the new session
during an add() operation. This so that the flush() operation
will also delete or modify rows of those disconnected items.
Mike Bayer [Fri, 29 Jan 2010 22:20:55 +0000 (22:20 +0000)]
- the "connection" argument from engine.transaction() and
engine.run_callable() is removed - Connection itself
now has those methods. All four methods accept
*args and **kwargs which are passed to the given callable,
as well as the operating connection.
Mike Bayer [Fri, 29 Jan 2010 18:55:03 +0000 (18:55 +0000)]
for string deferred evals, don't return the underlying Column, rely upon the original propcomparator to do what it wants.
reduces duplication of the "columns[0]" rule and removes potentially surprise behavior from the eval
Mike Bayer [Thu, 28 Jan 2010 23:49:22 +0000 (23:49 +0000)]
- the "autocommit" flag on select() and text() as well
as select().autocommit() are deprecated - now call
.execution_options(autocommit=True) on either of those
constructs, also available directly on Connection and orm.Query.
Mike Bayer [Mon, 25 Jan 2010 21:04:50 +0000 (21:04 +0000)]
- Added a tuple_() construct, allows sets of expressions
to be compared to another set, typically with IN against
composite primary keys or similar. Also accepts an
IN with multiple columns. The "scalar select can
have only one column" error message is removed - will
rely upon the database to report problems with
col mismatch.
Mike Bayer [Mon, 25 Jan 2010 00:35:28 +0000 (00:35 +0000)]
- union(), intersect(), except() and other "compound" types
of statements have more consistent behavior w.r.t.
parenthesizing. Each compound element embedded within
another will now be grouped with parenthesis - previously,
the first compound element in the list would not be grouped,
as SQLite doesn't like a statement to start with
parenthesis. However, Postgresql in particular has
precedence rules regarding INTERSECT, and it is
more consistent for parenthesis to be applied equally
to all sub-elements. So now, the workaround for SQLite
is also what the workaround for PG was previously -
when nesting compound elements, the first one usually needs
".alias().select()" called on it to wrap it inside
of a subquery. [ticket:1665]
Mike Bayer [Sun, 24 Jan 2010 22:50:58 +0000 (22:50 +0000)]
- Connection has execution_options(), generative method
which accepts keywords that affect how the statement
is executed w.r.t. the DBAPI. Currently supports
"stream_results", causes psycopg2 to use a server
side cursor for that statement. Can also be set
upon select() and text() constructs directly as well
as ORM Query().
Philip Jenvey [Sun, 24 Jan 2010 21:32:09 +0000 (21:32 +0000)]
test_notsane_working needs to run first for dialects that don't
supports_sane_rowcount so the other VersioningTests don't ignore the warning it
expects (that ignore lasts forever)
Mike Bayer [Sun, 24 Jan 2010 18:41:30 +0000 (18:41 +0000)]
- oracle + firebird: "case sensitivity" feature will detect an all-lowercase
case-sensitive column name during reflect and add
"quote=True" to the generated Column, so that proper
quoting is maintained.
Mike Bayer [Sat, 23 Jan 2010 19:44:06 +0000 (19:44 +0000)]
- types.Binary is renamed to types.LargeBinary, it only
produces BLOB, BYTEA, or a similar "long binary" type.
New base BINARY and VARBINARY
types have been added to access these MySQL/MS-SQL specific
types in an agnostic way [ticket:1664].
Mike Bayer [Wed, 20 Jan 2010 19:26:12 +0000 (19:26 +0000)]
- query.select_from() also accepts mapped classes, aliased()
constructs, and mappers as arguments. In particular this
helps when querying from multiple joined-table classes to ensure
the full join gets rendered.
Mike Bayer [Wed, 20 Jan 2010 17:48:43 +0000 (17:48 +0000)]
moved the metadata step of ResultProxy into a ResultMetaData object. this also replaces PickledResultProxy.
Allows RowProxy objects to reference just the metadata they need and provides the "core" of ResultProxy
detached from the object itself, allowing ResultProxy implementations to vary more easily. will also
enable [ticket:1635]
Mike Bayer [Tue, 19 Jan 2010 00:53:12 +0000 (00:53 +0000)]
- mega example cleanup
- added READMEs to all examples in each __init__.py and added to sphinx documentation
- added versioning example
- removed vertical/vertical.py, the dictlikes are more straightforward
Mike Bayer [Mon, 18 Jan 2010 03:00:05 +0000 (03:00 +0000)]
- added native INTERVAL type to the dialect. This supports
only the DAY TO SECOND interval type so far due to lack
of support in cx_oracle for YEAR TO MONTH. [ticket:1467]
- The Interval type includes a "native" flag which controls
if native INTERVAL types (postgresql + oracle) are selected
if available, or not. "day_precision" and "second_precision"
arguments are also added which propagate as appropriately
to these native types. Related to [ticket:1467].
- DefaultDialect.type_descriptor moves back to being per-dialect.
TypeEngine/TypeDecorator key type impls to the dialect class
+ server_version_info so that the colspecs dict can be modified
per-dialect based on server version.
- Fixed TypeDecorator's incorrect usage of _impl_dict
Mike Bayer [Sun, 17 Jan 2010 21:12:47 +0000 (21:12 +0000)]
- remove the exclusion of cx_oracle.STRING from setinputsizes by
configuring cx_oracle.UNICODE on OracleNVarChar. Attempts
were made to pass unicode data to/from a plain VARCHAR2 with
cx_oracle, both with and without setinputsizes in use, but
it doesn't appear to be possible - therefore users will need to use
Unicode/UnicodeText with oracle if data contains non-ASCII info.
[ticket:1517]
- updated the Unicode/UnicodeText docs to reflect this, that
convert_unicode might not be enough.
- allowed convert_unicode='force' to be significant for bind parameters
as well.
Mike Bayer [Sun, 17 Jan 2010 20:32:45 +0000 (20:32 +0000)]
- reorganized and re-documented Oracle schema tests to assume
test user has DBA privs, and all objects can be created /dropped.
- added ORDER BY to oracle column listing
- Oracle all_tables always limits to current user if schema not given.
- views reflect - added documentation + a unit test for this.
- Table(autoload) with no bind produces an error message specific to
the fact that autoload_with should be the first option to try.
Mike Bayer [Sat, 16 Jan 2010 22:44:04 +0000 (22:44 +0000)]
- added "statement_options()" to Query, to so options can be
passed to the resulting statement. Currently only
Select-statements have these options, and the only option
used is "stream_results", and the only dialect which knows
"stream_results" is psycopg2.
- Query.yield_per() will set the "stream_results" statement
option automatically.
- Added "statement_options()" to Selects, which set statement
specific options. These enable e.g. dialect specific options
such as whether to enable using server side cursors, etc.
- The psycopg2 now respects the statement option
"stream_results". This option overrides the connection setting
"server_side_cursors". If true, server side cursors will be
used for the statement. If false, they will not be used, even
if "server_side_cursors" is true on the
connection. [ticket:1619]
- added a "frozendict" from http://code.activestate.com/recipes/414283/,
adding more default collections as immutable class vars on
Query, Insert, Select
Mike Bayer [Sat, 16 Jan 2010 19:04:39 +0000 (19:04 +0000)]
- ConnectionProxy now has wrapper methods for all transaction
lifecycle events, including begin(), rollback(), commit()
begin_nested(), begin_prepared(), prepare(), release_savepoint(),
etc.
Mike Bayer [Sat, 16 Jan 2010 18:04:11 +0000 (18:04 +0000)]
- sqlsoup objects no longer have the 'query' attribute - it's
not needed for sqlsoup's usage paradigm and it gets in the
way of a column that is actually named 'query'.
Mike Bayer [Wed, 13 Jan 2010 18:31:19 +0000 (18:31 +0000)]
- replace the tip of the path info with the subclass mapper being used.
that way accurate "load_path" info is available for options
invoked during deferred loads.
we lose AliasedClass path elements this way, but currently,
those are not needed at this stage.
Mike Bayer [Mon, 11 Jan 2010 20:26:34 +0000 (20:26 +0000)]
have paths represented as their actual mapper, not the base mapper, allowing
more information for custom mapper opts to see what's going on. add a new _reduce_path()
function to apply to the path as stored in dictionaries, adds a slight cost overhead.