diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/mssql/base.py | 1 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/base.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/engine/result.py | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_ddl.py | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/testing/suite/test_insert.py | 2 |
6 files changed, 11 insertions, 5 deletions
@@ -967,6 +967,10 @@ are also present in 0.8. attribute, causing the construct to not compile correctly a second time. [ticket:2545] + - [bug] Fixed bug where reflection of primary key constraint + would double up columns if the same constraint/table + existed in multiple schemas. + 0.7.8 ===== - orm diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 755237587..6dd25350f 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1419,6 +1419,7 @@ class MSDialect(default.DefaultDialect): # Primary key constraints s = sql.select([C.c.column_name, TC.c.constraint_type], sql.and_(TC.c.constraint_name == C.c.constraint_name, + TC.c.table_schema == C.c.table_schema, C.c.table_name == tablename, C.c.table_schema == owner) ) diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index e8b22fdc6..05ca0f980 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -882,8 +882,10 @@ class Connection(Connectable): if context._is_implicit_returning: context._fetch_implicit_returning(result) result.close(_autoclose_connection=False) + result._metadata = None elif not context._is_explicit_returning: result.close(_autoclose_connection=False) + result._metadata = None elif result._metadata is None: # no results, get rowcount # (which requires open cursor on some drivers diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py index a9bb248b3..bf6410f15 100644 --- a/lib/sqlalchemy/engine/result.py +++ b/lib/sqlalchemy/engine/result.py @@ -369,6 +369,7 @@ class ResultProxy(object): _process_row = RowProxy out_parameters = None _can_close_connection = False + _metadata = None def __init__(self, context): self.context = context @@ -382,9 +383,7 @@ class ResultProxy(object): def _init_metadata(self): metadata = self._cursor_description() - if metadata is None: - self._metadata = None - else: + if metadata is not None: self._metadata = ResultMetaData(self, metadata) def keys(self): diff --git a/lib/sqlalchemy/testing/suite/test_ddl.py b/lib/sqlalchemy/testing/suite/test_ddl.py index 2bd2518bf..466429aa5 100644 --- a/lib/sqlalchemy/testing/suite/test_ddl.py +++ b/lib/sqlalchemy/testing/suite/test_ddl.py @@ -11,7 +11,7 @@ class TableDDLTest(fixtures.TestBase): def _simple_fixture(self): return Table('test_table', self.metadata, - Column('id', Integer, primary_key=True), + Column('id', Integer, primary_key=True, autoincrement=False), Column('data', String(50)) ) diff --git a/lib/sqlalchemy/testing/suite/test_insert.py b/lib/sqlalchemy/testing/suite/test_insert.py index 53a70e0c6..0a9896ffb 100644 --- a/lib/sqlalchemy/testing/suite/test_insert.py +++ b/lib/sqlalchemy/testing/suite/test_insert.py @@ -103,7 +103,7 @@ class InsertBehaviorTest(fixtures.TablesTest): ) assert r.closed assert r.is_insert - assert r.returns_rows + assert not r.returns_rows __all__ = ('InsertSequencingTest', 'InsertBehaviorTest') |