Mike Bayer [Sat, 30 Sep 2006 04:40:15 +0000 (04:40 +0000)]
- internal refactoring to mapper instances() method to use a
SelectionContext object to track state during the operation.
SLIGHT API BREAKAGE: the append_result() and populate_instances()
methods on MapperExtension have a slightly different method signature
now as a result of the change; hoping that these methods are not
in widespread use as of yet.
Mike Bayer [Thu, 28 Sep 2006 05:26:26 +0000 (05:26 +0000)]
- more adjustments to the eager load table finder to work with existing mappings
against selects and query-created limit/offset subselects
- added eagertest3 to orm/alltests.py
Mike Bayer [Thu, 28 Sep 2006 04:53:00 +0000 (04:53 +0000)]
- added test suite to test improved from_obj/join behavior with Query/eagerloading/SelectResults
- EagerLoader looks more carefully for the correct Table/Join/FromClause to bind its outer join onto
- sqlite boolean datatype converts bind params from python booleans to integer
- took out assertion raise from 'name' property of CompoundSelect
Mike Bayer [Thu, 28 Sep 2006 01:46:16 +0000 (01:46 +0000)]
- pool will auto-close open cursors, or can be configured to raise an error instead
- consolidated scalar() calls into ResultProxy scalar(), fixed ResultProxy scalar() to
apply typing rules
- general de-cruftification of ClauseElement/Compiled (yes i know theres crufty things everywhere)
Mike Bayer [Wed, 27 Sep 2006 07:08:26 +0000 (07:08 +0000)]
- specifying joins in the from_obj argument of query.select() will
replace the main table of the query, if the table is somewhere within
the given from_obj. this makes it possible to produce custom joins and
outerjoins in queries without the main table getting added twice.
[ticket:315]
- added join_to and outerjoin_to transformative methods to SelectResults,
to build up join/outerjoin conditions based on property names. also
added select_from to explicitly set from_obj parameter.
- factored "results" arrays from the mapper test suite and into the
"tables" mapper
- added "viewonly" param to docs
Mike Bayer [Wed, 27 Sep 2006 05:08:22 +0000 (05:08 +0000)]
- added an automatic "row switch" feature to mapping, which will
detect a pending instance/deleted instance pair with the same
identity key and convert the INSERT/DELETE to a single UPDATE
- "association" mappings simplified to take advantage of
automatic "row switch" feature
- fixes [ticket:311]
Mike Bayer [Sun, 24 Sep 2006 23:59:22 +0000 (23:59 +0000)]
- logging is now implemented via standard python "logging" module.
"echo" keyword parameters are still functional but set/unset
log levels for their respective classes/instances. all logging
can be controlled directly through the Python API by setting
INFO and DEBUG levels for loggers in the "sqlalchemy" namespace.
class-level logging is under "sqlalchemy.<module>.<classname>",
instance-level logging under "sqlalchemy.<module>.<classname>.<hexid>".
Test suite includes "--log-info" and "--log-debug" arguments
which work independently of --verbose/--quiet. Logging added
to orm to allow tracking of mapper configurations, row iteration
fixes [ticket:229] [ticket:79]
Mike Bayer [Sat, 23 Sep 2006 23:03:50 +0000 (23:03 +0000)]
descriptive error message when an executioncontext-requiring call is called off a ResultProxy which was created via literal statement execution and therefore does not have an execution context.
Mike Bayer [Sat, 23 Sep 2006 21:02:33 +0000 (21:02 +0000)]
- added "mutable" flag to PickleType, set to False to allow old (faster) behavior
- fix attribute unit test
- attributes have explicit flag for "mutable_scalars", propigated by ColumnProperty
Mike Bayer [Sat, 23 Sep 2006 20:26:20 +0000 (20:26 +0000)]
- added "pickleable" module to test suite to have cPickle-compatible
test objects
- added copy_function, compare_function arguments to InstrumentedAttribute
- added MutableType mixin, copy_value/compare_values methods to TypeEngine,
PickleType
- ColumnProperty and DeferredProperty propigate the TypeEngine copy/compare
methods to the attribute instrumentation
- cleanup of UnitOfWork, removed unused methods
- UnitOfWork "dirty" list is calculated across the total collection of persistent
objects when called, no longer has register_dirty.
- attribute system can still report "modified" status fairly quickly, but does
extra work for InstrumentedAttributes that have detected a "mutable" type where
catching the __set__() event is not enough (i.e. PickleTypes)
- attribute tracking modified to be more intelligent about detecting
changes, particularly with mutable types. TypeEngine objects now
take a greater role in defining how to compare two scalar instances,
including the addition of a MutableType mixin which is implemented by
PickleType. unit-of-work now tracks the "dirty" list as an expression
of all persistent objects where the attribute manager detects changes.
The basic issue thats fixed is detecting changes on PickleType
objects, but also generalizes type handling and "modified" object
checking to be more complete and extensible.
Mike Bayer [Sat, 23 Sep 2006 17:21:56 +0000 (17:21 +0000)]
- added autoincrement=True to Column; will disable schema generation
of SERIAL/AUTO_INCREMENT/identity seq for postgres/mysql/mssql if
explicitly set to False. #303
Mike Bayer [Sat, 23 Sep 2006 00:06:10 +0000 (00:06 +0000)]
- fixed unfortunate mutating-dictionary glitch from previous checkin
- added "batch=True" flag to mapper; if False, save_obj
will fully save one object at a time including calls
to before_XXXX and after_XXXX
Mike Bayer [Fri, 22 Sep 2006 00:33:44 +0000 (00:33 +0000)]
- moved selectresults test from orm to ext package
- renamed objectstore test suite to unitofwork
- added additional "eagerdegrade" tests to mapper, to test fixes from #308
Mike Bayer [Thu, 21 Sep 2006 20:26:33 +0000 (20:26 +0000)]
- adjustments to eager loading so that its "eager chain" is
kept separate from the normal mapper setup, thereby
preventing conflicts with lazy loader operation, fixes
[ticket:308]
Mike Bayer [Thu, 21 Sep 2006 17:15:33 +0000 (17:15 +0000)]
- BooleanExpression includes new "negate" argument to specify
the appropriate negation operator if one is available.
- calling a negation on an "IN" or "IS" clause will result in
"NOT IN", "IS NOT" (as opposed to NOT (x IN y)).
Mike Bayer [Mon, 11 Sep 2006 00:20:28 +0000 (00:20 +0000)]
- implemented "version check" logic in Query/Mapper, used
when version_id_col is in effect and query.with_lockmode()
is used to get() an instance thats already loaded
[ticket:292]
Mike Bayer [Sun, 10 Sep 2006 23:52:04 +0000 (23:52 +0000)]
- changed "for_update" parameter to accept False/True/"nowait"
and "read", the latter two of which are interpreted only by
Oracle and Mysql [ticket:292]
- added "lockmode" argument to base Query select/get functions,
including "with_lockmode" function to get a Query copy that has
a default locking mode. Will translate "read"/"update"
arguments into a for_update argument on the select side.
[ticket:292]
Mike Bayer [Thu, 7 Sep 2006 20:04:10 +0000 (20:04 +0000)]
- more rearrangements of unit-of-work commit scheme to better allow
dependencies within circular flushes to work properly...updated
task traversal/logging implementation
this work is still under construction ! requires more unit tests and
new dumper needs to be finished.
Mike Bayer [Tue, 5 Sep 2006 16:58:02 +0000 (16:58 +0000)]
restored "optimistic" behavior of hasparent. its generally disastrous without that flag as its impossible to load all lazy loaders, deal with attributes that "noload", etc. just to check for orphan status.
Mike Bayer [Sat, 2 Sep 2006 04:00:44 +0000 (04:00 +0000)]
- further changes to attributes with regards to "trackparent". the "commit" operation
now sets a "hasparent" flag for all attributes to all objects. that way lazy loads
via callables get included in trackparent, and eager loads do as well because the mapper
calls commit() on all objects at load time. this is a less shaky method than the "optimistic"
thing in the previous commit, but uses more memory and involves more overhead.
- some tweaks/cleanup to unit tests
Mike Bayer [Fri, 1 Sep 2006 17:01:55 +0000 (17:01 +0000)]
futher fix to the "orphan state" idea. to avoid setting tons of
"hasparent" flags on objects as they are loaded, both from lazy and eager loads,
the "orphan" check now uses an "optimistic" flag to determine the result if no
"hasparent" flag is found for a particular relationship on an instance. if the
instance has an _instance_key and therefore was loaded from the database, it is
assumed to not be an orphan unless a "False" hasparent flag has been set. if the
instance does not have an _instance_key and is therefore transient/pending, it is
assumed to be an orphan unless a "True" hasparent flag has been set.
Mike Bayer [Thu, 31 Aug 2006 18:58:22 +0000 (18:58 +0000)]
- added case_sensitive argument to MetaData, Table, Column, determines
itself automatically based on if a parent schemaitem has a non-None
setting for the flag, or if not, then whether the identifier name is all lower
case or not. when set to True, quoting is applied to identifiers with mixed or
uppercase identifiers. quoting is also applied automatically in all cases to
identifiers that are known to be reserved words or contain other non-standard
characters. various database dialects can override all of this behavior, but
currently they are all using the default behavior. tested with postgres, mysql,
sqlite. needs more testing with firebird, oracle, ms-sql. part of the ongoing
work with [ticket:155]
Mike Bayer [Sat, 26 Aug 2006 21:32:11 +0000 (21:32 +0000)]
- changed "invalidate" semantics with pooled connection; will
instruct the underlying connection record to reconnect the next
time its called. "invalidate" will also automatically be called
if any error is thrown in the underlying call to connection.cursor().
this will hopefully allow the connection pool to reconnect to a
database that had been stopped and started without restarting
the connecting application [ticket:121]
Mike Bayer [Sat, 26 Aug 2006 19:46:33 +0000 (19:46 +0000)]
- added "timezone=True" flag to DateTime and Time types. postgres
so far will convert this to "TIME[STAMP] (WITH|WITHOUT) TIME ZONE",
so that control over timezone presence is more controllable (psycopg2
returns datetimes with tzinfo's if available, which can create confusion
against datetimes that dont).
[ticket:275]
Mike Bayer [Fri, 25 Aug 2006 16:27:10 +0000 (16:27 +0000)]
- cleanup on connection methods + documentation. custom DBAPI
arguments specified in query string, 'connect_args' argument
to 'create_engine', or custom creation function via 'creator'
function to 'create_engine'.
- added "recycle" argument to Pool, is "pool_recycle" on create_engine,
defaults to 3600 seconds; connections after this age will be closed and
replaced with a new one, to handle db's that automatically close
stale connections [ticket:274]