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]
Mike Bayer [Thu, 30 Dec 2010 17:14:32 +0000 (12:14 -0500)]
- A little more verbiage to the "primaryjoin" error,
in an unusual condition that the join condition
"works" for viewonly but doesn't work for non-viewonly,
and foreign_keys wasn't used - adds "foreign_keys" to
the suggestion. Also add "foreign_keys" to the
suggestion for the generic "direction" error.
Mike Bayer [Wed, 29 Dec 2010 20:04:35 +0000 (15:04 -0500)]
- mutable examples now move into sqlalchemy.ext.mutable
- streamline interfaces, get Mutable/MutableComposite to be as minimal
in usage as possible
- docs for mutable, warnings regrarding mapper events being global
- move MutableType/mutable=True outwards, move orm tests to its
own module, note in all documentation
- still need more events/tests for correct pickling support of
composites, mutables. in the case of composites its needed
even without mutation. see [ticket:2009]
Mike Bayer [Wed, 29 Dec 2010 03:23:13 +0000 (22:23 -0500)]
- restore mapper.get_property() to use the _props dict. at the moment
synonyms for relationships might just be taken out altogether, since they aren't
documented and are of little use. a plain proxying descriptor, combined with
attribute-based usage with Query (as opposted to naming it by string)
can do the same thing more simply.
- add event support to composites, change the model around so that the composite
is generated at the point of load.
- add a recipe for tracking mutations on composites. will probably make both
of these mutations examples into extensions since they're intricate, should
have a lot of test coverage, and what they need to do is fairly straightforward.
Will use metaclasses so that no extra userland step is needed beyond usage
of the type.
Mike Bayer [Tue, 28 Dec 2010 22:50:36 +0000 (17:50 -0500)]
- simplified the descriptor system to no longer use the hybrid extension, instead presenting
the Proxy(QueryableAttribute) object as the public facing interface. This simplifies
the descriptor system and will allow straightforward integration with attribute events.
Mike Bayer [Sat, 25 Dec 2010 19:08:03 +0000 (14:08 -0500)]
- on_expire event, since we are starting to build off of events around
full lifecycle
- composite will use events to do everything we want it to, i.e.
storing the composite in __dict__, invalidating it on change
of any of the columns.
- will reinstate mutability of composites via callable attached
to the composite - but userland code will still need to establish
change event listening on the composite itself, perhaps via
a "mutable" mixin like the scalars.py example, perhaps via
addition of descriptors to the mutable object.