Commit Graph

47 Commits

Author SHA1 Message Date
Julien Castets edfe2deffb Accept unicode in CascadeOptions 2015-03-16 16:23:14 +01:00
jona 98a0114535 add failing test 2014-09-12 21:14:52 +02:00
Mike Bayer 33c7cfff6e - Added a new directive used within the scope of an attribute "set" operation
to disable autoflush, in the case that the attribute needs to lazy-load
the "old" value, as in when replacing one-to-one values or some
kinds of many-to-one.  A flush at this point otherwise occurs
at the point that the attribute is None and can cause NULL violations.
[ticket:2921]
2014-01-31 19:57:38 -05:00
Mike Bayer 59ca4633ac - remove informix dialect, moved out to https://bitbucket.org/zzzeek/sqlalchemy_informixdb
- remove informix, maxdb, access symbols from tests etc.
2013-11-17 13:45:23 -05:00
Mike Bayer 1b25ed907f - merge ticket_1418 branch, [ticket:1418]
- The system of loader options has been entirely rearchitected to build
upon a much more comprehensive base, the :class:`.Load` object.  This
base allows any common loader option like :func:`.joinedload`,
:func:`.defer`, etc. to be used in a "chained" style for the purpose
of specifying options down a path, such as ``joinedload("foo").subqueryload("bar")``.
The new system supersedes the usage of dot-separated path names,
multiple attributes within options, and the usage of ``_all()`` options.
-  Added a new load option :func:`.orm.load_only`.  This allows a series
of column names to be specified as loading "only" those attributes,
deferring the rest.
2013-10-06 20:29:08 -04:00
Mike Bayer b83dd4dc22 Can set/change the "cascade" attribute on a :func:.relationship
construct after it's been constructed already.  This is not
a pattern for normal use but we like to change the setting
for demonstration purposes in tutorials.
2013-03-02 20:27:53 -05:00
Mike Bayer a477f8a61e the consideration of a pending object as
an "orphan" has been modified to more closely match the
behavior as that of persistent objects, which is that the object
is expunged from the :class:`.Session` as soon as it is
de-associated from any of its orphan-enabled parents.  Previously,
the pending object would be expunged only if de-associated
from all of its orphan-enabled parents.  The new flag ``legacy_is_orphan``
is added to :func:`.orm.mapper` which re-establishes the
legacy behavior. [ticket:2655]
2013-01-24 21:31:23 -05:00
Mike Bayer 20cdc64588 trying different approaches to test layout. in this one, the testing modules
become an externally usable package but still remains within the main sqlalchemy parent package.
in this system, we use kind of an ugly hack to get the noseplugin imported outside of the
"sqlalchemy" package, while still making it available within sqlalchemy for usage by
third party libraries.
2012-09-27 02:37:33 -04:00
Mike Bayer 9665015708 - [feature] Adding/removing None from a mapped collection
now generates attribute events.  Previously, a None
append would be ignored in some cases.  Related
to [ticket:2229].

- [feature] The presence of None in a mapped collection
now raises an error during flush.   Previously,
None values in collections would be silently ignored.
[ticket:2229]
2012-08-13 11:00:58 -04:00
Mike Bayer 22ba1c43b7 -whitespace bonanza, contd 2012-07-28 17:05:50 -04:00
Mike Bayer b9406da13e remove deprecateds 2012-06-08 14:40:45 -04:00
Mike Bayer 2086728eb5 - [bug] The warning emitted when using
delete-orphan cascade with one-to-many
or many-to-many without single-parent=True
is now an error.  The ORM
would fail to function subsequent to this
warning in any case.  [ticket:2405]
2012-04-24 11:58:14 -04:00
Mike Bayer 0987f89516 - [bug] Fixed the repr() for CascadeOptions to
include refresh-expire.  Also reworked
CascadeOptions to be a <frozenset>.
[ticket:2417]
2012-02-29 18:27:17 -05:00
Mike Bayer b3fa5d0326 - [bug] Updated warning message when setting
delete-orphan without delete to no longer
refer to 0.6, as we never got around to
upgrading this to an exception.  Ideally
this might be better as an exception but
it's not critical either way.  [ticket:2325]
- add new test suite to test_cascades for cascade
arguments
2011-12-04 16:23:55 -05:00
Mike Bayer eba7816abb fix broken tests 2011-07-24 13:01:13 -04:00
Mike Bayer 0cc357c6ca - Fixed regression from 0.6 where Session.add()
against an object which contained None in a
collection would raise an internal exception.
Reverted this to 0.6's behavior which is to
accept the None but obviously nothing is
persisted.  Ideally, collections with None
present or on append() should at least emit a
warning, which is being considered for 0.8.
[ticket:2205]
2011-07-24 12:37:48 -04:00
Mike Bayer d326fe639b add an autoincrement here 2011-06-08 17:56:00 -04:00
Mike Bayer c25412d90a - "delete-orphan" cascade is now allowed on
self-referential relationships - this since
SQLA 0.7 no longer enforces "parent with no
child" at the ORM level; this check is left
up to foreign key nullability.
Related to [ticket:1912]
- a lot of cleanup and refactoring on relationship()
init, clarification
2011-06-04 19:01:52 -04:00
Mike Bayer 1da499a838 - Added checks inside the UOW to detect the unusual
condition of being asked to UPDATE or DELETE
on a primary key value that contains NULL
in it.  [ticket:2127]

- Some refinements to attribute history.  More
changes are pending possibly in 0.8, but
for now history has been modified such that
scalar history doesn't have a "side effect"
of populating None for a non-present value.
This allows a slightly better ability to
distinguish between a None set and no actual
change, affects [ticket:2127] as well.

- rewriting the history tests in test_attributes to be
individual per operation/assertion.   its a huge job
so this is partial for the moment.
2011-04-10 20:22:11 -04:00
Mike Bayer 7b24e458c7 - move all the comments that got shoved below the fixture grabs back up 2011-03-27 17:19:00 -04:00
Mike Bayer 68a350d462 - remove test.sql._base, test.engine._base, test.orm._base, move those classes to a new test.lib.fixtures module
- move testing.TestBase to test.lib.fixtures
- massive search and replace
2011-03-27 16:27:27 -04:00
Mike Bayer a3083eabf4 - move all the setup_classes(cls) and setup_mappers(cls) to use a
local cls.Basic, cls.Comparable base class so that there is no ambiguity
or hash identity behaviors getting in the way of class registration.
2011-03-27 15:04:06 -04:00
Mike Bayer e3dbb87d94 - move _fixtures to work via the normal methods of _base.MappedTest, convert
all referncing tests to not use globals
- tests that deal with pickle specifically load the fixture classes
from test.lib.pickleable, which gets some more classes added
- removed weird sa05 pickling tests that don't matter
2011-03-26 20:44:47 -04:00
Mike Bayer 14a2fae239 - remove @testing.resolve_artifact_names, replace with direct attribute
access to the cls/self.tables/classes registries
- express orm/_base.py ORMTest in terms of engine/_base.py TablesTest,
factor out common steps into TablesTest, remove AltEngineTest as a
separate class.   will further consolidate these base classes
2011-03-26 19:03:11 -04:00
Mike Bayer 350aed3fdb - whitespace removal bonanza 2011-01-02 14:23:42 -05:00
Mike Bayer ecf1571ba7 - factor out the dependency on the "on_" name 2010-12-30 14:07:15 -05:00
Mike Bayer ec5b48d8fa merge backout 2010-11-28 16:29:39 -05:00
Mike Bayer ca9d3cea39 after some usage, its clear that [ticket:1974] should not be implemented. backrefs
add to collections so its expected that collection membership would mirror in session
membership.
Backed out changeset e836366c84
2010-11-28 16:27:44 -05:00
Mike Bayer 58b2939433 - sqlalchemy.test and nose plugin moves back to being entirely
outside of "sqlalchemy" and under "test/".

Rationale:

- coverage plugin works without issue, without need for an awkward
additional package install
- command line for "nosetests" isn't polluted with SQLAlchemy options

[ticket:1949]
2010-11-28 14:19:44 -05:00
Mike Bayer e836366c84 - cascade_backrefs flag on relationship() now set to False by default.
[ticket:1974]
2010-11-28 13:01:23 -05:00
Mike Bayer 45cdb17ef0 - fixes for PG, mysql, twophase
- added "pool_events" arg to create_engine(), "events" to pool, allowing
establishment of listeners which fire before those of the dialect
2010-11-20 17:57:30 -05:00
Mike Bayer 99859369d1 - merge no-save-cascade collection flushes branch, [ticket:1973] 2010-11-20 15:11:12 -05:00
Mike Bayer 3f0793a4f5 one more orphan test 2010-11-20 14:56:27 -05:00
Mike Bayer 5c611f702c - the in-flush check for "pending orphan being flushed" has been removed.
It's now possible to issue INSERT for an object that would otherwise
be an orphan due to no parent object specified, along a relationship
that specifies "delete-orphan" cascade.  The detection of this condition
as an error should now be accomplished via NOT NULL foreign keys.
[ticket:1912]
2010-11-20 14:52:21 -05:00
Mike Bayer 61c76f92df - repair remaining tests 2010-11-20 11:35:16 -05:00
Mike Bayer 1321a0c2b9 - establish a consistent pattern of behavior along o2m, m2m, and m2o relationships
when "save-update" cascade is disabled, or the target object is otherwise not
present in the session, and collection/scalar changes have taken place.  A warning
is emitted describing the type of operation, the target reference, and the relationship
description, stating that the operation will not take place.  The operation then doesn't
take place.   [ticket:1973]
- clean up test_cascade a little bit, remove cruft
2010-11-17 19:34:47 -05:00
Mike Bayer e1402efb19 - move sqlalchemy.test to test.lib 2010-11-15 19:37:50 -05:00
Mike Bayer eae4de02a9 - in depth docs about some merge() tips
- docs about backref cascade
- Another new flag on relationship(), cascade_backrefs,
disables the "save-update" cascade when the event was
initiated on the "reverse" side of a bidirectional
relationship.   This is a cleaner behavior so that
many-to-ones can be set on a transient object without
it getting sucked into the child object's session,
while still allowing the forward collection to
cascade.   We *might* default this to False in 0.7.
2010-09-22 14:22:16 -04:00
Mike Bayer 5cce6bf2a8 - experimenting with pytidy with mods as a textmate plugin along
the path to 78 chars.   eh
2010-07-10 14:50:13 -04:00
Mike Bayer 44c67fef8c - starting to groom the branch for its inclusion
- one-to-many relationships now maintain a list of positive
parent-child associations within the flush, preventing
previous parents marked as deleted from cascading a
delete or NULL foreign key set on those child objects,
despite the end-user not removing the child from the old
association. [ticket:1764]
- re-established Preprocess as unique on their arguments,
as they were definitely duped in inheritance scenarios
- added a "memo" feature to UOWTransaction which represents the usual
pattern of using the .attributes collection
- added the test case from [ticket:1081] into perf/
2010-04-10 19:21:54 -04:00
Mike Bayer c6bceb7775 - converted all lazy=True|False|None to 'select'|'joined'|'noload'
- converted all eager to joined in examples
- fixed beaker/advanced.py to reference RelationshipCache
2010-03-24 19:19:03 -04:00
Mike Bayer 065fcbd9d2 - The official name for the relation() function is now
relationship(), to eliminate confusion over the relational
algebra term.  relation() however will remain available
in equal capacity for the foreseeable future.  [ticket:1740]
2010-03-17 17:48:29 -04:00
Mike Bayer 1f7e0c069c - Fixed cascade bug in many-to-one relation() when attribute
was set to None, introduced in r6711 (cascade deleted
items into session during add()).
2010-02-16 23:33:20 +00:00
Mike Bayer 489d5010fd - 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.
2010-01-30 18:28:37 +00:00
Mike Bayer 659ca0c508 added a test for #1349 2009-11-03 04:30:18 +00:00
Mike Bayer 8fc5005dfe merge 0.6 series to trunk. 2009-08-06 21:11:27 +00:00
Mike Bayer 45cec095b4 - unit tests have been migrated from unittest to nose.
See README.unittests for information on how to run
the tests.  [ticket:970]
2009-06-10 21:18:24 +00:00