[Sqlalchemy-commits] commit/sqlalchemy: 13 new changesets
Brought to you by:
zzzeek
From: Bitbucket <com...@bi...> - 2015-11-29 16:43:46
|
13 new commits in sqlalchemy: https://bitbucket.org/zzzeek/sqlalchemy/commits/fc73036865a0/ Changeset: fc73036865a0 Branch: None User: Gorka Eguileor Date: 2015-09-24 13:35:13+00:00 Summary: Preserve order in update method In some DBs the UPDATE operation is order dependent, so the operation behaves differently depending on the order of the values. As an example, imagine a volumes table with columns 'status' and 'previous_status' and we want to update a volume that has 'available' in the status column. If the SQL query is performed as: UPDATE volumes SET previous_status=status, status='new' WHERE id=1; This will result in a volume with 'new' status and 'available' previous_status both on SQLite and MariaDB, but if we reverse the columns: UPDATE volumes SET status='new', previous_status=status WHERE id=1; We will get the same result in SQLite but will result in a volume with status and previous_status set to 'new' in MariaDB, which is not what we want. So order must be taken into consideration in some cases and it should be allowed to ve specified via the Query update method or the values method of an update. This patch fixes this issue by preserving the order of parameters in updates and allowing to receive not only dictionaries in update and values but also ordered dictionaries and list/tuples of value pairs (like dict and OrderedDict do). fixes #3541 Affected #: 10 files https://bitbucket.org/zzzeek/sqlalchemy/commits/9fb76d759678/ Changeset: 9fb76d759678 Branch: None User: Gorka Eguileor Date: 2015-09-29 18:29:33+00:00 Summary: Only preserve order in updates if tuple/dict To avoid penalties for updates that do not require ordering, we will only use OrderedDict for updates that receive a tuple or list of pairs, and all kinds of dictionaries (dict, sqlalchemy's OrderedDict, or collections.OrderedDict) will be treateated as unordered updates, just like we were doing before. This way this new feature will not change how updates behave for any existing code and will only affect those that use the new ordered feature. This patch reverts update tests to how they were before as well as adds a couple of tests to confirm that OrderedDicts are really treated like normal dicts. Affected #: 11 files https://bitbucket.org/zzzeek/sqlalchemy/commits/ddb43cebf68b/ Changeset: ddb43cebf68b Branch: None User: Gorka Eguileor Date: 2015-09-30 16:45:05+00:00 Summary: Postpone parameters change in ordered updates Postpone as much as possible the change of update parameters to OrderedDict from list or tuple of pairs. This way we won't have problems with query's update method. Affected #: 5 files https://bitbucket.org/zzzeek/sqlalchemy/commits/ef816f23290a/ Changeset: ef816f23290a Branch: None User: Gorka Eguileor Date: 2015-10-02 16:22:33+00:00 Summary: Only check once if parameters are ordered Instead of checking multiple times if parameters are a dictionary in the form of a tuple or list of value pairs, we check it only once and then store it in the statement so it can be used on compilation time. Affected #: 4 files https://bitbucket.org/zzzeek/sqlalchemy/commits/c6ba1a7d4c2b/ Changeset: c6ba1a7d4c2b Branch: None User: Gorka Eguileor Date: 2015-10-05 08:42:09+00:00 Summary: Remove dict comprehension for py26 compatibility Remove added dict comprehensions that make this patch set non python 2.6 compatible. Affected #: 2 files https://bitbucket.org/zzzeek/sqlalchemy/commits/44e5a31ccee5/ Changeset: 44e5a31ccee5 Branch: None User: Gorka Eguileor Date: 2015-10-08 11:24:02+00:00 Summary: Reduce the numbers of calls to isinstance Change _process_colparams method to remove duplicate isinstance calls and try to speed up processing of the parameters. Affected #: 3 files https://bitbucket.org/zzzeek/sqlalchemy/commits/1106bd3ff270/ Changeset: 1106bd3ff270 Branch: None User: zzzeek Date: 2015-11-25 23:19:36+00:00 Summary: Merge remote-tracking branch 'origin/pr/200' into pr200 Affected #: 8 files https://bitbucket.org/zzzeek/sqlalchemy/commits/ab0874e893af/ Changeset: ab0874e893af Branch: None User: zzzeek Date: 2015-11-26 00:39:17+00:00 Summary: - work from an "explicit is better than implicit" perspective here and require a flag on update() to use parameter ordering rather than table ordering. more docs/changelog notes are needed Affected #: 5 files https://bitbucket.org/zzzeek/sqlalchemy/commits/b8a825978e79/ Changeset: b8a825978e79 Branch: None User: zzzeek Date: 2015-11-28 17:23:21+00:00 Summary: - add tests for ordered params with onupdates Affected #: 1 file https://bitbucket.org/zzzeek/sqlalchemy/commits/e9dfcd83ef43/ Changeset: e9dfcd83ef43 Branch: None User: zzzeek Date: 2015-11-28 18:32:30+00:00 Summary: - docs plus changelog for parameter ordered updates Affected #: 4 files https://bitbucket.org/zzzeek/sqlalchemy/commits/3635408cd62a/ Changeset: 3635408cd62a Branch: pr200_updated User: zzzeek Date: 2015-11-28 19:21:35+00:00 Summary: - unfortunately, these are not the query.update() tests, these are just session bind tests. move / rework the preserve_parameter_order tests to the appropriate module Affected #: 2 files https://bitbucket.org/zzzeek/sqlalchemy/commits/b0308a7b3af9/ Changeset: b0308a7b3af9 Branch: None User: zzzeek Date: 2015-11-29 16:42:55+00:00 Summary: - Fixed an issue in baked queries where the .get() method, used either directly or within lazy loads, didn't consider the mapper's "get clause" as part of the cache key, causing bound parameter mismatches if the clause got re-generated. This clause is cached by mappers on the fly but in highly concurrent scenarios may be generated more than once when first accessed. fixes #3597 Affected #: 3 files https://bitbucket.org/zzzeek/sqlalchemy/commits/670fd506fe4c/ Changeset: 670fd506fe4c Branch: rel_1_0 User: zzzeek Date: 2015-11-29 16:43:30+00:00 Summary: - Fixed an issue in baked queries where the .get() method, used either directly or within lazy loads, didn't consider the mapper's "get clause" as part of the cache key, causing bound parameter mismatches if the clause got re-generated. This clause is cached by mappers on the fly but in highly concurrent scenarios may be generated more than once when first accessed. fixes #3597 (cherry picked from commit b0308a7b3af91cc61fbe3347376024ad8b7be019) Affected #: 3 files Repository URL: https://bitbucket.org/zzzeek/sqlalchemy/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |