Commit Graph

46 Commits

Author SHA1 Message Date
Mike Bayer ed3e3f2571 - util.flatten_iterator() func doesn't interpret strings with
__iter__() methods as iterators, such as in pypy [ticket:1077].
2008-10-31 21:44:34 +00:00
Mike Bayer 3bf1ddfb91 a much easier way to ArgSingleton 2008-10-12 04:25:53 +00:00
Jason Kirtland aaf72e05f1 - Ignore old-style classes when building inheritance graphs. [ticket:1078] 2008-08-15 22:54:35 +00:00
Jason Kirtland 8fa48edbf9 - Removed 2.3 set emulations/enhancements.
(sets.Set-based collections & DB-API returns still work.)
2008-07-15 19:23:52 +00:00
Jason Kirtland 8b6855fc2c Added default support to OrderedDict.pop [ticket:585] 2008-07-10 19:16:08 +00:00
Jason Kirtland eaa4328aac - consider args[0] as self when introspecting def(*args): ... [ticket:1091] 2008-06-29 18:58:11 +00:00
Mike Bayer 4a6afd469f r4695 merged to trunk; trunk now becomes 0.5.
0.4 development continues at /sqlalchemy/branches/rel_0_4
2008-05-09 16:34:10 +00:00
Jason Kirtland afd8431d4d - Pool listeners may now be specified as a duck-type of PoolListener or a dict of callables, your choice. 2008-04-04 19:07:30 +00:00
Jason Kirtland a86dc8cbac - symbols now depickle properly
- fixed some symbol __new__ abuse
2008-03-19 18:02:47 +00:00
Mike Bayer c0b5a0446b - updated the naming scheme of the base test classes in test/testlib/testing.py;
tests extend from either TestBase or ORMTest, using additional mixins for
special assertion methods as needed
2008-02-11 00:28:39 +00:00
Jason Kirtland e94c3ba27a - IdentitySet binops no longer accept plain sets. 2008-01-24 01:00:41 +00:00
Jason Kirtland f6439ffa2c Corrected behavior of get_cls_kwargs and friends 2008-01-24 00:08:40 +00:00
Jason Kirtland 412c80dd6c - 2.3 fixup, part two: 100% passing for sqlite
- added 2.4-style binops to util.Set on 2.3
  - OrderedSets pickle on 2.3
  - more lib/sqlalchemy set vs Set corrections
  - fixed InstrumentedSet.discard for 2.3
  - set, sorted compatibility for test suite
- added testing.fails_if decorator
2008-01-21 23:19:39 +00:00
Jason Kirtland 4be99db15b - Restored 2.3 compat. in lib/sqlalchemy
- Part one of test suite fixes to run on 2.3
  Lots of failures still around sets; sets.Set differs from __builtin__.set
  particularly in the binops. We depend on set extensively now and may need to
  provide a corrected sets.Set subclass on 2.3.
2008-01-19 23:37:11 +00:00
Jason Kirtland 17d3c8764e - testbase is gone, replaced by testenv
- Importing testenv has no side effects- explicit functions provide similar behavior to the old immediate behavior of testbase
- testing.db has the configured db
- Fixed up the perf/* scripts
2008-01-12 22:03:42 +00:00
Mike Bayer 0df750223a - merged instances_yields branch r3908:3934, minus the "yield" part which remains slightly problematic
- cleanup of mapper._instance, query.instances().  mapper identifies objects which are part of the
current load using a app-unique id on the query context.
- attributes refactor; attributes now mostly use copy-on-modify instead of copy-on-load behavior,
simplified get_history(), added a new set of tests
- fixes to OrderedSet such that difference(), intersection() and others can accept an iterator
- OrderedIdentitySet passes in OrderedSet to the IdentitySet superclass for usage in difference/intersection/etc. operations so that these methods actually work with ordering behavior.
- query.order_by() takes into account aliased joins, i.e.  query.join('orders', aliased=True).order_by(Order.id)
- cleanup etc.
2007-12-14 05:53:18 +00:00
Jason Kirtland 273e48c9a9 - Raise an error when assigning a bogusly keyed dictionary to one of the builtin dict-based collection types [ticket:886]
- Collections gain a @converter framework for flexible validation and adaptation of bulk assignment
- Bogus bulk assignments now raise TypeError instead of exceptions.ArgumentError
2007-12-14 00:13:18 +00:00
Mike Bayer 1b1f8d78df fixed test which didnt pass along 'allitems' collection to the sort... 2007-12-08 19:15:12 +00:00
Mike Bayer 8693d4b287 - flush() refactor merged from uow_nontree branch r3871-r3885
- topological.py cleaned up, presents three public facing functions which
return list/tuple based structures, without exposing any internals.  only
the third function returns the "hierarchical" structure.  when results
include "cycles" or "child" items, 2- or 3- tuples are used to represent
results.
- unitofwork uses InstanceState almost exclusively now.  new and deleted lists
are now dicts which ref the actual object to provide a strong ref for the
duration that they're in those lists.  IdentitySet is only used for the public
facing versions of "new" and "deleted".
- unitofwork topological sort no longer uses the "hierarchical" version of the sort
for the base sort, only for the "per-object" secondary sort where it still
helps to group non-dependent operations together and provides expected insert
order.  the default sort deals with UOWTasks in a straight list and is greatly
simplified.  Tests all pass but need to see if svilen's stuff still works,
one block of code in _sort_cyclical_dependencies() seems to not be needed anywhere
but i definitely put it there for a reason at some point; if not hopefully we
can derive more test coverage from that.
- the UOWEventHandler is only applied to object-storing attributes, not
scalar (i.e. column-based) ones.  cuts out a ton of overhead when setting
non-object based attributes.
- InstanceState also used throughout the flush process, i.e. dependency.py,
mapper.save_obj()/delete_obj(), sync.execute() all expect InstanceState objects
in most cases now.
- mapper/property cascade_iterator() takes InstanceState as its argument,
but still returns lists of object instances so that they are not dereferenced.
- a few tricks needed when dealing with InstanceState, i.e. when loading a list
of items that are possibly fresh from the DB, you *have* to get the actual objects
into a strong-referencing datastructure else they fall out of scope immediately.
dependency.py caches lists of dependent objects which it loads now (i.e. history
collections).
- AttributeHistory is gone, replaced by a function that returns a 3-tuple of
added, unchanged, deleted.  these collections still reference the object
instances directly for the strong-referencing reasons mentiontioned, but
it uses less IdentitySet logic to generate.
2007-12-08 18:58:03 +00:00
Mike Bayer 78bb82a44b changed the anonymous numbering scheme to be more appealing
got tests running
2007-12-08 18:38:18 +00:00
Jason Kirtland 661774055c Added util.IdentitySet to support [ticket:676] and [ticket:834] 2007-10-31 09:13:12 +00:00
Mike Bayer 4127d22196 - fixed clear_mappers() behavior to better clean up after itself 2007-10-27 00:24:43 +00:00
Jason Kirtland 9d7c027cb7 - Now guarding against broken DB-APIs when wrapping their exceptions.
- Added an explicit test for exception wrapping.
2007-10-22 19:24:02 +00:00
Jason Kirtland 6228e72cb1 - omitted 'table' and 'column' from 'from sqlalchemy import *'
- also omitted all modules and classes that aren't expicitly public
- omitted 'Smallinteger' (small i), but it's still in schema
- omitted NullType-related items from types.__all__
- patched up a few tests to use sql.table and sql.column, other related.
2007-08-21 01:31:23 +00:00
Mike Bayer ed4fc64bb0 merging 0.4 branch to trunk. see CHANGES for details. 0.3 moves to maintenance branch in branches/rel_0_3. 2007-07-27 04:08:53 +00:00
Mike Bayer c249066dbf "alltests" runners call testbase.main(), which takes an optional suite,
so that exit code is propigated
2007-03-15 18:11:05 +00:00
Mike Bayer 238e8620ee - fix for very large topological sorts, courtesy ants.aasma at gmail [ticket:423] 2007-02-13 01:25:51 +00:00
Mike Bayer 2d4e0d27dc further refactoring of topological sort for clarity 2006-11-11 03:03:55 +00:00
Mike Bayer b547f30d28 more fixes to topological sort with regards to cycles, fixes [ticket:365] 2006-11-11 01:34:41 +00:00
Mike Bayer ef48ddc503 - fix to subtle condition in topological sort where a node could appear twice,
for [ticket:362]
2006-11-04 06:11:21 +00:00
Mike Bayer 0be0131a44 fixed some imports, transaction hanging open 2006-10-22 19:10:44 +00:00
Mike Bayer bc240be3f8 - attributes module and test suite moves underneath 'orm' package
- fixed table comparison example in metadata.txt
- docstrings all over the place
- renamed mapper _getattrbycolumn/_setattrbycolumn to get_attr_by_column,set_attr_by_column
- removed frommapper parameter from populate_instance().  the two operations can be performed separately
- fix to examples/adjacencytree/byroot_tree.py to fire off lazy loaders upon load, to reduce query calling
- added get(), get_by(), load() to MapperExtension
- re-implemented ExtensionOption (called by extension() function)
- redid _ExtensionCarrier to function dynamically based on __getattribute__
- added logging to attributes package, indicating the execution of a lazy callable
- going to close [ticket:329]
2006-10-22 00:24:26 +00:00
Mike Bayer 3e871d2755 - 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
2006-09-23 21:02:33 +00:00
Mike Bayer 7d74fc7785 - 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.
2006-09-23 20:26:20 +00:00
Mike Bayer 20f15720da 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. 2006-09-05 16:58:02 +00:00
Mike Bayer fe0a1aa7fa - 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
2006-09-02 04:00:44 +00:00
Mike Bayer 35e2f6680b 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.
2006-09-01 17:01:55 +00:00
Mike Bayer 005603e2fb insure that "parent" pointers are set up on objects that were lazily loaded 2006-09-01 16:25:20 +00:00
Mike Bayer aff1798c36 adjusted __getstate__ on InstrumentedList to further avoid callables getting stuck in there... 2006-08-08 01:02:16 +00:00
Mike Bayer 63519a4f04 fixed small pickle bug with lazy loaders [ticket:265] 2006-08-06 16:48:30 +00:00
Mike Bayer 3c64a0cf73 [ticket:254] 2006-07-24 16:25:40 +00:00
Mike Bayer 49090a7a94 fixed attribute manager's ability to traverse the full set of managed attributes for a descendant class, + 2 unit tests 2006-06-26 19:55:48 +00:00
Mike Bayer bcc4f63a07 removed historyarray test
ForeignKey is more intelligent about locating the parent table it represents, in the case that
its attached to a CompoundSelect column which has multiple "originals", some of which might not be schema.Columns
2006-06-16 19:02:10 +00:00
Mike Bayer 84fdccc0cb merged attributes rewrite 2006-06-15 15:53:00 +00:00
Mike Bayer dd061f40b4 "parent track" function needed to be more specific to the parent class 2006-06-10 19:40:26 +00:00
Mike Bayer 120dcee5a7 reorganized unit tests into subdirectories 2006-06-05 17:25:51 +00:00