summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/sync.py
Commit message (Collapse)AuthorAgeFilesLines
* happy new year 2023Mike Bayer2023-01-031-1/+1
| | | | Change-Id: I625af65b3fb1815b1af17dc2ef47dd697fdc3fb1
* revenge of pep 484Mike Bayer2022-05-151-8/+8
| | | | | | trying to get remaining must-haves for ORM Change-Id: I66a3ecbbb8e5ba37c818c8a92737b576ecf012f7
* inline mypy config; files ignoring type errors for the momentMike Bayer2022-04-281-0/+2
| | | | | | | | | | | | | | | | | | | to simplify pyproject.toml change the remaining files that aren't going to be typed on this first pass (unless of course someone wants to type some of these) to include # mypy: ignore-errors. for the moment, only a handful of ORM modules are to have more type checking implemented. It's important that ignore-errors is used and not "# type: ignore", as in the latter case, mypy doesn't even read the existing types in the file, which makes it impossible to type any files that refer to those modules at all. to simplify ongoing typing work use inline mypy config for remaining files that are "done" for now, indicating the level of type checking they currently have. Change-Id: I98669c1a305c2f0adba85d10b5425541f3fe9533
* pep-484 for sqlalchemy.event; use future annotationsMike Bayer2022-02-151-0/+2
| | | | | | | | | | __future__.annotations mode allows us to use non-string annotations for argument and return types in most cases, but more importantly it removes a large amount of runtime overhead that would be spent in evaluating the annotations. Change-Id: I2f5b6126fe0019713fc50001be3627b664019ede References: #6810
* happy new year 2022Mike Bayer2022-01-061-1/+1
| | | | Change-Id: I49abf2607e0eb0623650efdf0091b1fb3db737ea
* Replace raise_ with raise fromFederico Caselli2021-12-271-22/+15
| | | | | Change-Id: I7aaeb5bc130271624335b79cf586581d6c6c34c7 References: #4600
* Replace all http:// links to https://Federico Caselli2021-07-041-1/+1
| | | | | | Also replace http://pypi.python.org/pypi with https://pypi.org/project Change-Id: I84b5005c39969a82140706472989f2a30b0c7685
* happy new yearMike Bayer2021-01-041-1/+1
| | | | Change-Id: Ic5bb19ca8be3cb47c95a0d3315d84cb484bac47c
* Ensure all nested exception throws have a causeMike Bayer2020-03-021-28/+35
| | | | | | | | | | | | | | | Applied an explicit "cause" to most if not all internally raised exceptions that are raised from within an internal exception catch, to avoid misleading stacktraces that suggest an error within the handling of an exception. While it would be preferable to suppress the internally caught exception in the way that the ``__suppress_context__`` attribute would, there does not as yet seem to be a way to do this without suppressing an enclosing user constructed context, so for now it exposes the internally caught exception as the cause so that full information about the context of the error is maintained. Fixes: #4849 Change-Id: I55a86b29023675d9e5e49bc7edc5a2dc0bcd4751
* happy new yearMike Bayer2020-01-011-1/+1
| | | | Change-Id: I08440dc25e40ea1ccea1778f6ee9e28a00808235
* happy new yearMike Bayer2019-01-111-1/+1
| | | | Change-Id: I6a71f4924d046cf306961c58dffccf21e9c03911
* Post black reformattingMike Bayer2019-01-061-1/+3
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-23/+41
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* happy new yearMike Bayer2018-01-121-1/+1
| | | | Change-Id: I3ef36bfd0cb0ba62b3123c8cf92370a43156cf8f
* update for 2017 copyrightMike Bayer2017-01-041-1/+1
| | | | Change-Id: I4e8c2aa8fe817bb2af8707410fa0201f938781de
* - happy new yearMike Bayer2016-01-291-1/+1
|
* - Fixed more regressions caused by NEVER_SET; comparisonsMike Bayer2015-04-201-2/+2
| | | | | | | | | to transient objects with attributes unset would leak NEVER_SET, and negated_contains_or_equals would do so for any transient object as the comparison used only the committed value. Repaired the NEVER_SET cases, fixes #3371, and also made negated_contains_or_equals() use state_attr_by_column() just like a non-negated comparison, fixes #3374
* - copyright 2015Mike Bayer2015-03-101-1/+1
|
* - fix inheritance persistenceMike Bayer2014-12-071-0/+17
| | | | - start writing docs
* - apply pep8 formatting to sqlalchemy/sql, sqlalchemy/util, sqlalchemy/dialects,Brian Jarrett2014-07-201-19/+20
| | | | sqlalchemy/orm, sqlalchemy/event, sqlalchemy/testing
* - break up the <authors> copyright comment as part of a passMike Bayer2014-07-091-1/+2
| | | | to get all flake8 passing
* - Adjustment to attribute mechanics concerning when a value isMike Bayer2014-05-291-1/+1
| | | | | | | | | | | | | | implicitly initialized to None via first access; this action, which has always resulted in a population of the attribute, now emits an attribute event just like any other attribute set operation and generates the same kind of history as one. Additionally, many mapper internal operations will no longer implicitly generate these "None" values when various never-set attributes are checked. These are subtle behavioral fixes to attribute mechanics which provide a better solution to the problem of :ticket:`3060`, which also involves recognition of attributes explicitly set to ``None`` vs. attributes that were never set. fixes #3061
* - Fixed a few edge cases which arise in the so-called "row switch"Mike Bayer2014-05-281-1/+4
| | | | | | | | | | | scenario, where an INSERT/DELETE can be turned into an UPDATE. In this situation, a many-to-one relationship set to None, or in some cases a scalar attribute set to None, may not be detected as a net change in value, and therefore the UPDATE would not reset what was on the previous row. This is due to some as-yet unresovled side effects of the way attribute history works in terms of implicitly assuming None isn't really a "change" for a previously un-set attribute. See also :ticket:`3061`. fixes #3060
* - happy new yearMike Bayer2014-01-051-1/+1
|
* Detection of a primary key change within the processMike Bayer2013-02-251-1/+2
| | | | | | | of cascading a natural primary key update will succeed even if the key is composite and only some of the attributes have changed. [ticket:2665]
* happy new year (see #2645)Diana Clarke2013-01-011-1/+1
|
* just a pep8 pass of lib/sqlalchemy/orm/Diana Clarke2012-11-191-7/+16
|
* -whitespace bonanza, contdMike Bayer2012-07-281-6/+6
|
* - move all of orm to use absolute importsMike Bayer2012-06-231-2/+2
| | | | | | | | - break out key mechanics of loading objects into new "orm.loading" module, removing implementation details from both mapper.py and query.py. is analogous to persistence.py - some other cleanup and old cruft removal
* - [removed] Deprecated identifiers removed:Mike Bayer2012-06-211-14/+14
| | | | | | | | | | | | | | * allow_null_pks mapper() argument (use allow_partial_pks) * _get_col_to_prop() mapper method (use get_property_by_column()) * dont_load argument to Session.merge() (use load=True) * sqlalchemy.orm.shard module (use sqlalchemy.ext.horizontal_shard)
* break out _save_obj(), _delete_obj(), _post_update() into a new moduleMike Bayer2012-01-301-0/+1
| | | | | | | persistence.py - Mapper loses awareness of how to emit INSERT/UPDATE/DELETE, persistence.py is only used by unitofwork.py. Then break each method out into a top level with almost no logic, calling into _organize_states_for_XYZ(), _collect_XYZ_commands(), _emit_XYZ_statements().
* happy new yearMike Bayer2012-01-041-1/+1
|
* - Fixed the error message emitted for "can'tMike Bayer2011-05-071-1/+1
| | | | | | | | execute syncrule for destination column 'q'; mapper 'X' does not map this column" to reference the correct mapper. [ticket:2163]. Also in 0.6.8. - test/orm/test_sync.py covers orm/sync.py 100%
* corrected a bunch of spelling typosDiana Clarke2011-02-281-1/+1
|
* - replace all usage of True and False for passive with PASSIVE_NO_INITIALIZE,Mike Bayer2011-02-111-3/+5
| | | | | | PASSIVE_OFF, now expresed as non-boolean symbols - make "passive" available positionally on all get_history() methods, call it like that
* - whitespace removal bonanzaMike Bayer2011-01-021-3/+3
|
* - clean up copyright, update for 2011, stamp every file withMike Bayer2011-01-021-2/+2
| | | | | a consistent tag - AUTHORS file
* - with composites gone all the get_col_value crap is gone tooMike Bayer2010-12-201-2/+9
|
* - callcountsMike Bayer2010-12-101-2/+3
|
* Apply more memoization to Mapper attributes & subject to group expiry.Jason Kirtland2010-09-031-1/+1
|
* - Moving an o2m object from one collection toMike Bayer2010-07-221-2/+2
| | | | | | | | | | | | | | | | | another, or vice versa changing the referenced object by an m2o, where the foreign key is also a member of the primary key, will now be more carefully checked during flush if the change in value of the foreign key on the "many" side is the result of a change in the primary key of the "one" side, or if the "one" is just a different object. In one case, a cascade-capable DB would have cascaded the value already and we need to look at the "new" PK value to do an UPDATE, in the other we need to continue looking at the "old". We now look at the "old", assuming passive_updates=True, unless we know it was a PK switch that triggered the change. [ticket:1856]
* - starting to groom the branch for its inclusionMike Bayer2010-04-101-2/+1
| | | | | | | | | | | | | | - 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/
* - dict_ becomes explicit on _get_state_attr_by_column, ↵Mike Bayer2010-04-071-5/+5
| | | | | | | | | _set_state_attr_by_column, others, to reduce on expensive state.dict calls. - internal getattr(), setattr(), getcommitted() methods on ColumnProperty, CompositeProperty, RelationshipProperty have been underscored, signature has changed.
* - cleanup some long lines. (test hg commit hook)Mike Bayer2010-03-071-7/+22
|
* - Primary key values can now be changed on a joined-table inheritanceMike Bayer2010-02-021-1/+11
| | | | | | | | | | | | object, and ON UPDATE CASCADE will be taken into account when the flush happens. Set the new "passive_updates" flag to False on mapper() when using SQLite or MySQL/MyISAM. [ticket:1362] - flush() now detects when a primary key column was updated by an ON UPDATE CASCADE operation from another primary key, and can then locate the row for a subsequent UPDATE on the new PK value. This occurs when a relation() is there to establish the relationship as well as passive_updates=True. [ticket:1671]
* happy new yearMike Bayer2010-01-071-1/+1
|
* - Removed all* O(N) scanning behavior from the flush() process,Mike Bayer2009-05-171-14/+6
| | | | | | | | | | | i.e. operations that were scanning the full session, including an extremely expensive one that was erroneously assuming primary key values were changing when this was not the case. * one edge case remains which may invoke a full scan, if an existing primary key attribute is modified to a new value.
* happy new yearMike Bayer2009-01-121-1/+1
|
* - added some abstraction to the attributes.History objectMike Bayer2008-10-281-4/+4
| | | | | - Repaired support for "passive-deletes" on a many-to-one relation() with "delete" cascade. [ticket:1183]
* r4695 merged to trunk; trunk now becomes 0.5.Mike Bayer2008-05-091-19/+14
| | | | 0.4 development continues at /sqlalchemy/branches/rel_0_4