diff options
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 11 | ||||
-rw-r--r-- | setup.py | 3 | ||||
-rw-r--r-- | test/sql/test_query.py | 9 | ||||
-rw-r--r-- | test/sql/test_rowcount.py | 3 |
5 files changed, 23 insertions, 8 deletions
@@ -5,6 +5,11 @@ CHANGES ======= 0.6.1 ===== +- sql + - Fixed bug that prevented implicit RETURNING from functioning + properly with composite primary key that contained zeroes. + [ticket:1778] + - oracle - Added a check for cx_oracle versions lower than version 5, in which case the incompatible "output type handler" won't diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index fc49c62fa..a8c336336 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -576,9 +576,14 @@ class DefaultExecutionContext(base.ExecutionContext): table = self.compiled.statement.table row = resultproxy.fetchone() - self._inserted_primary_key = [v is not None and v or row[c] - for c, v in zip(table.primary_key, self._inserted_primary_key) - ] + ipk = [] + for c, v in zip(table.primary_key, self._inserted_primary_key): + if v is not None: + ipk.append(v) + else: + ipk.append(row[c]) + + self._inserted_primary_key = ipk def last_inserted_params(self): return self._last_inserted_params @@ -117,9 +117,6 @@ SQLAlchemy's Advantages: * Data mapping can be used in a row-based manner. Any bizarre hyper-optimized query that you or your DBA can cook up, you can run in SQLAlchemy, and as long as it returns the expected columns within a rowset, you can get your objects from it. For a rowset that contains more than one kind of object per row, multiple mappers can be chained together to return multiple object instance lists from a single database round trip. * The type system allows pre- and post- processing of data, both at the bind parameter and the result set level. User-defined types can be freely mixed with built-in types. Generic types as well as SQL-specific types are available. -SVN version: -<http://svn.sqlalchemy.org/sqlalchemy/trunk#egg=SQLAlchemy-dev> - """, classifiers = [ "Development Status :: 5 - Production/Stable", diff --git a/test/sql/test_query.py b/test/sql/test_query.py index 80d524bf1..5a4f03311 100644 --- a/test/sql/test_query.py +++ b/test/sql/test_query.py @@ -160,6 +160,15 @@ class QueryTest(TestBase): {'id':'id1'}, {'id':'id1', 'bar':'hi'}, ), + ( + {'unsupported':['sqlite']}, + Table("t6", metadata, + Column('id', Integer, primary_key=True, test_needs_autoincrement=True), + Column('bar', Integer, primary_key=True) + ), + {'bar':0}, + {'id':1, 'bar':0}, + ), ]: if testing.db.name in supported['unsupported']: continue diff --git a/test/sql/test_rowcount.py b/test/sql/test_rowcount.py index c12e2b272..ccd0d8f5e 100644 --- a/test/sql/test_rowcount.py +++ b/test/sql/test_rowcount.py @@ -9,9 +9,8 @@ class FoundRowsTest(TestBase, AssertsExecutionResults): @classmethod def setup_class(cls): - metadata = MetaData(testing.db) - global employees_table, metadata + metadata = MetaData(testing.db) employees_table = Table('employees', metadata, Column('employee_id', Integer, |