Mike Bayer [Fri, 11 Feb 2011 22:58:49 +0000 (17:58 -0500)]
- fix long lines in test_attributes
- add deprecation warning to get_history() when passed
True or False, convert
- rearrange symbol() so we can get sphinx autodata to work
Mike Bayer [Fri, 11 Feb 2011 20:37:44 +0000 (15:37 -0500)]
- replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,
PASSIVE_OFF, now expresed as non-boolean symbols
- make "passive" available positionally on all get_history() methods,
call it like that
Mike Bayer [Fri, 11 Feb 2011 19:41:29 +0000 (14:41 -0500)]
- Additional tuning to "many-to-one" relationship
loads during a flush(). A change in version 0.6.6
([ticket:2002]) required that more "unnecessary" m2o
loads during a flush could occur. Extra loading modes have
been added so that the SQL emitted in this
specific use case is trimmed back, while still
retrieving the information the flush needs in order
to not miss anything. [ticket:2049]
Mike Bayer [Fri, 11 Feb 2011 03:27:45 +0000 (22:27 -0500)]
- The concept of associating a ".bind" directly with a
ClauseElement has been explicitly moved to Executable,
i.e. the mixin that describes ClauseElements which represent
engine-executable constructs. This change is an improvement
to internal organization and is unlikely to affect any
real-world usage. [ticket:2048]
Mike Bayer [Fri, 11 Feb 2011 02:57:44 +0000 (21:57 -0500)]
- Added over() function, method to FunctionElement
classes, produces the _Over() construct which
in turn generates "window functions", i.e.
"<window function> OVER (PARTITION BY <partition by>,
ORDER BY <order by>)".
[ticket:1844]
Mike Bayer [Thu, 10 Feb 2011 20:03:11 +0000 (15:03 -0500)]
- The path given as the location of a sqlite database is now
normalized via os.path.abspath(), so that directory changes
within the process don't affect the ultimate location
of a relative file path. [ticket:2036]
Mike Bayer [Thu, 10 Feb 2011 19:17:08 +0000 (14:17 -0500)]
- Query.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>). [ticket:1069]
- select.distinct() now accepts column expressions
as *args, interpreted by the Postgresql dialect
as DISTINCT ON (<expr>). Note this was already
available via passing a list to the `distinct`
keyword argument to select(). [ticket:1069]
- select.prefix_with() accepts multiple expressions
(i.e. *expr), 'prefix' keyword argument to select()
accepts a list or tuple.
- Passing a string to the `distinct` keyword argument
of `select()` for the purpose of emitting special
MySQL keywords (DISTINCTROW etc.) is deprecated -
use `prefix_with()` for this.
- put kw arguments to select() in order
- restore docs for _SelectBase, renamed from _SelectBaseMixin
Mike Bayer [Thu, 10 Feb 2011 16:30:23 +0000 (11:30 -0500)]
- An exception is raised in the unusual case that an
append or similar event on a collection occurs after
the parent object has been dereferenced, which
prevents the parent from being marked as "dirty"
in the session. Will commit as a warning in 0.6.
[ticket:2046]
Mike Bayer [Thu, 10 Feb 2011 00:18:33 +0000 (19:18 -0500)]
- py3k fix regarding new exception system
- this test keeps throwing a TNS error on Oracle on the buildbot only, runs locally,
seems to be related to some scaling/memory type of issue on the bot
Mike Bayer [Wed, 9 Feb 2011 23:11:40 +0000 (18:11 -0500)]
- Non-DBAPI errors which occur in the scope of an `execute()`
call are now wrapped in sqlalchemy.exc.StatementError,
and the text of the SQL statement and repr() of params
is included. This makes it easier to identify statement
executions which fail before the DBAPI becomes
involved. [ticket:2015]
Mike Bayer [Wed, 9 Feb 2011 21:30:49 +0000 (16:30 -0500)]
- figured out the ::autodata directive, can move the docstring for
expression.func into the .py module
- added a note about logging only being checked on new connections,
as one user had this issue awhile back, and I suspect it for
a current ML user issue
Mike Bayer [Wed, 9 Feb 2011 20:45:15 +0000 (15:45 -0500)]
- The compiler extension now supports overriding the default
compilation of expression._BindParamClause including that
the auto-generated binds within the VALUES/SET clause
of an insert()/update() statement will also use the new
compilation rules. [ticket:2042]
Mike Bayer [Wed, 9 Feb 2011 20:14:54 +0000 (15:14 -0500)]
- Fixed bug where a column with a SQL or server side default
that was excluded from a mapping with include_properties
or exclude_properties would result in UnmappedColumnError.
[ticket:1995]
Mike Bayer [Wed, 9 Feb 2011 20:06:32 +0000 (15:06 -0500)]
- add connection and cursor to is_disconnect(). We aren't using it yet,
but we'd like to. Most DBAPIs don't give us anything we can do with it.
Some research was done on psycopg2 and it still seems like they give us
no adequate method (tried connection.closed, cursor.closed, connection.status).
mxodbc claims their .closed attribute will work (but I am skeptical).
- remove beahvior in pool that auto-invalidated a connection when
the cursor failed to create. That's not the pool's job. we need the conn
for the error logic. Can't get any tests to fail, curious why that
behavior was there, guess we'll find out (or not).
- add support for psycopg2 version detection. even though we have
no use for it yet...
- adjust one of the reconnect tests to work with oracle's
horrendously slow connect speed
Mike Bayer [Mon, 7 Feb 2011 21:12:24 +0000 (16:12 -0500)]
- Adjusted flush accounting step to occur before
the commit in the case of autocommit=True. This allows
autocommit=True to work appropriately with
expire_on_commit=True, and also allows post-flush session
hooks to operate in the same transactional context
as when autocommit=False. [ticket:2041]
Mike Bayer [Sat, 5 Feb 2011 21:09:49 +0000 (16:09 -0500)]
- A single contains_eager() call across
multiple entities will indicate all collections
along that path should load, instead of requiring
distinct contains_eager() calls for each endpoint
(which was never correctly documented).
[ticket:2032]
- The "name" field used in orm.aliased() now renders
in the resulting SQL statement.
Mike Bayer [Fri, 4 Feb 2011 23:33:49 +0000 (18:33 -0500)]
- apply optimizations to alternate row proxies, [ticket:1787]
- add check to fetchmany() for None, don't send argument if not present,
helps DBAPIs which don't accept "None" for default (ie. pysqlite, maybe others)
- add tests to test_execute to provide 100% coverage for the three alternate
result proxy classes
Mike Bayer [Fri, 4 Feb 2011 22:37:36 +0000 (17:37 -0500)]
- When explicit sequence execution derives the name
of the auto-generated sequence of a SERIAL column,
which currently only occurs if implicit_returning=False,
now accommodates if the table + column name is greater
than 63 characters using the same logic Postgresql uses.
[ticket:1083]
Mike Bayer [Wed, 2 Feb 2011 23:10:07 +0000 (18:10 -0500)]
- Fixed bug where "middle" class in a polymorphic hierarchy
would have no 'polymorphic_on' column if it didn't also
specify a 'polymorphic_identity', leading to strange
errors upon refresh, wrong class loaded when querying
from that target. [ticket:2038]
Mike Bayer [Tue, 1 Feb 2011 21:34:37 +0000 (16:34 -0500)]
- Some adjustments so that Interbase is supported as well.
FB/Interbase version idents are parsed into a structure
such as (8, 1, 1, 'interbase') or (2, 1, 588, 'firebird')
so they can be distinguished. [ticket:1885]
- fixed relfection of the "autoincrement" flag against a default
placed on the column.
Mike Bayer [Tue, 1 Feb 2011 14:26:36 +0000 (09:26 -0500)]
- schema.copy() functions will copy dispatch, but only for those events
added with propagate=True. needs tests
- oracle/fb test schema uses event w/ propagate=True to apply
Sequence to primary key columns with test_needs_autoincrement.
this does actually test the propagate=True flag a bit since it's
needed in the declarative mixin tests where the 'id' column
is copied.
Mike Bayer [Mon, 31 Jan 2011 01:29:48 +0000 (20:29 -0500)]
- SchemaItem, SchemaType now descend from common type
SchemaEventTarget, which supplies dispatch
- the dispatch now provides before_parent_attach(),
after_parent_attach(), events which generally bound the _set_parent()
event. [ticket:2037]
- the _on_table_attach mechanism now usually uses the
event dispatch
- fixed class-level event dispatch to propagate to all subclasses, not just
immediate subclasses
- fixed class-level event unpickling to handle more involved
inheritance hierarchies, needed by the new schema event dispatch.
- ForeignKeyConstraint doesn't re-call the column attach event
on ForeignKey objects that are already associated with the correct
Column
- we still need that ImportError on mysqldb CLIENT FLAGS to support
mock DBAPIs
Mike Bayer [Sun, 30 Jan 2011 19:18:01 +0000 (14:18 -0500)]
- A warning is emitted when a joined-table inheriting mapper
has no primary keys on the locally mapped table
(but has pks on the superclass table). [ticket:2019]
Mike Bayer [Sun, 30 Jan 2011 18:39:08 +0000 (13:39 -0500)]
- Added a `name` argument to `Query.subquery()`, to allow
a fixed name to be assigned to the alias object.
[ticket:2030]
- changed the kw name 'alias' to 'name' on the alias() standalone
function.
- fixed up some alias/join docstrings
Mike Bayer [Thu, 20 Jan 2011 18:32:59 +0000 (13:32 -0500)]
rename 'frozendict' to 'immutabledict', since 'frozen' implies hashability
like frozenset which isn't really the purpose of 'immutabledict' (could be someday,
in which case, we'd change the name back :) )
Mike Bayer [Tue, 18 Jan 2011 22:13:36 +0000 (17:13 -0500)]
- Session.connection(), Session.execute() accept 'bind',
to allow execute/connection operations to participate
in the open transaction of an engine explicitly.
[ticket:1996]
- fix up the docs for connection, execute, which were awful.
- correct usage strings in hybrid
Mike Bayer [Tue, 18 Jan 2011 21:34:34 +0000 (16:34 -0500)]
- Session.merge() will check the version id of the incoming
state against that of the database, assuming the mapping
uses version ids and incoming state has a version_id
assigned, and raise StaleDataError if they don't
match. [ticket:2027]
Mike Bayer [Mon, 17 Jan 2011 01:18:32 +0000 (20:18 -0500)]
- the zblog example is obsolete, the tests don't really test it
and a key feature of its mapping (the deferred col outside of the select)
doesn't work anyway.
- add a token "deferred on selectable" test to test_mapper.
Mike Bayer [Sun, 16 Jan 2011 22:04:07 +0000 (17:04 -0500)]
- execution_options() on Connection accepts
"isolation_level" argument, sets transaction isolation
level for that connection only until returned to the
connection pool, for thsoe backends which support it
(SQLite, Postgresql) [ticket:2001]
- disallow the option on Engine (use isolation_level to create_engine()),
Executable (we don't want to check/set per statement)
- docs
Mike Bayer [Sun, 16 Jan 2011 18:05:18 +0000 (13:05 -0500)]
- factor consistent set_isolation_level(), get_isolation_level()
per-connection methods for sqlite, postgresql, psycopg2 dialects
- move isolation test suite to test engines/test_transaction
- preparing for [ticket:2001]
Mike Bayer [Sat, 15 Jan 2011 21:50:52 +0000 (16:50 -0500)]
Regarding reflection for this case, reflection of an int PK col
with a server_default sets the "autoincrement" flag to False,
except in the case of a PG SERIAL col where we detected a
sequence default. [ticket:2020] [ticket:2021]
Mike Bayer [Sat, 15 Jan 2011 21:42:29 +0000 (16:42 -0500)]
- getting slightly more consistent behavior for the edge case of pk columns
with server default - autoincrement is now false with any server_default,
so these all return None, applies consistency to [ticket:2020], [ticket:2021].
if prefetch is desired a "default" should be used instead of server_default.
Mike Bayer [Sat, 15 Jan 2011 18:25:03 +0000 (13:25 -0500)]
- composite now relates to its parent class in terms of MapperProperty,
not Column. This allows it to compose any mapped attributes, including
relationship(). [ticket:2024]
Mike Bayer [Sat, 15 Jan 2011 16:53:37 +0000 (11:53 -0500)]
- the _pk_processors/_prefetch_processors approach relied upon calling RPs without a cursor.description
result, also generates procs that are not used in most cases. simplify the approach
by passing type to _exec_default() to be used if needed by _execute_scalar(),
looking for the proc on just t._autoincrement_column in post_insert().
Mike Bayer [Wed, 12 Jan 2011 23:53:55 +0000 (18:53 -0500)]
QueryableAttribute can stringify itself without triggering a mapper compile. prevents confusion
when stringing the attr during an exception for something else like a bad event listen
Mike Bayer [Wed, 12 Jan 2011 20:49:59 +0000 (15:49 -0500)]
- dont count server_default absense as part of autoincrement, PG
will have a value here upon reflection.
- mysql, others will have to check "server_default" when rendering
special keywords like AUTOINCREMENT
Mike Bayer [Wed, 12 Jan 2011 20:35:20 +0000 (15:35 -0500)]
- rename hybrid.property_, hybrid.method to hybrid_property, hybrid_method. more typing
on the import but this is just clearer.
- adapt dictlike-polymorphic.py to use hybrid.
Mike Bayer [Tue, 11 Jan 2011 20:22:46 +0000 (15:22 -0500)]
- A TypeDecorator of Integer can be used with a primary key
column, and the "autoincrement" feature of various dialects
as well as the "sqlite_autoincrement" flag will honor
the underlying database type as being Integer-based.
[ticket:2005]
- Result-row processors are applied to pre-executed SQL
defaults, as well as cursor.lastrowid, when determining
the contents of result.inserted_primary_key.
[ticket:2006]
- Bind parameters present in the "columns clause" of a select
are now auto-labeled like other "anonymous" clauses,
which among other things allows their "type" to be meaningful
when the row is fetched, as in result row processors.
- TypeDecorator is present in the "sqlalchemy" import space.
Mike Bayer [Thu, 6 Jan 2011 17:25:17 +0000 (12:25 -0500)]
- Fixed bug regarding "subqueryload" strategy whereby
the join would fail if using a multi-level load
of the form from A->joined-subclass->C [ticket:2014]
Mike Bayer [Tue, 4 Jan 2011 18:48:46 +0000 (13:48 -0500)]
- The Index() construct can be created inline with a Table
definition, using strings as column names, as an alternative
to the creation of the index outside of the Table.
Mike Bayer [Tue, 4 Jan 2011 17:38:54 +0000 (12:38 -0500)]
- sorry, I really don't want metaclass recipes in the main documentation. Don't
want people using them, thinking they're needed in the general case, confused, etc.
The two sections here are moved to the wiki for now.
Mike Bayer [Tue, 4 Jan 2011 02:11:12 +0000 (21:11 -0500)]
- Firebird numeric type now checks for Decimal explicitly,
lets float() pass right through, thereby allowing
special values such as float('inf'). [ticket:2012]
Mike Bayer [Mon, 3 Jan 2011 00:54:31 +0000 (19:54 -0500)]
- add support for pickling with mutable scalars, mutable composites
- add pickle/unpickle events to ORM events. these are needed
for the mutable extension.
- finish mutable extension documentation, consolidate examples,
add full descriptions
Mike Bayer [Fri, 31 Dec 2010 16:46:30 +0000 (11:46 -0500)]
- add QueryContext to load(), refresh()
- add list of attribute names to refresh()
- ensure refresh() only called when attributes actually refreshed
- tests. [ticket:2011]