Fixed bug whereby using "key" with Column
in conjunction with "schema" for the owning Table would fail to locate result rows due to the MSSQL dialect's "schema rendering" logic's failure to take .key into account. [ticket:2607]
This commit is contained in:
parent
31adc09e42
commit
7a03aded91
File diff suppressed because it is too large
Load Diff
|
@ -882,7 +882,8 @@ class MSSQLCompiler(compiler.SQLCompiler):
|
|||
|
||||
if result_map is not None:
|
||||
result_map[column.name.lower()] = \
|
||||
(column.name, (column, ),
|
||||
(column.name, (column, column.name,
|
||||
column.key),
|
||||
column.type)
|
||||
|
||||
return super(MSSQLCompiler, self).\
|
||||
|
|
|
@ -199,9 +199,9 @@ def schemas(fn):
|
|||
named 'test_schema'."""
|
||||
|
||||
return skip_if([
|
||||
"sqlte",
|
||||
"sqlite",
|
||||
"firebird"
|
||||
], "no schema support")
|
||||
], "no schema support")(fn)
|
||||
|
||||
def sequences(fn):
|
||||
"""Target database must support SEQUENCEs."""
|
||||
|
@ -210,6 +210,7 @@ def sequences(fn):
|
|||
"postgresql", "firebird", "oracle"
|
||||
], "no SEQUENCE support")(fn)
|
||||
|
||||
|
||||
def update_nowait(fn):
|
||||
"""Target database must support SELECT...FOR UPDATE NOWAIT"""
|
||||
return skip_if(["access", "firebird", "mssql", "mysql", "sqlite", "sybase"],
|
||||
|
|
|
@ -1344,6 +1344,7 @@ class KeyTargetingTest(fixtures.TablesTest):
|
|||
Column('ctype', String(30), key="content_type")
|
||||
)
|
||||
|
||||
|
||||
@classmethod
|
||||
def insert_data(cls):
|
||||
cls.tables.keyed1.insert().execute(dict(b="a1", q="c1"))
|
||||
|
@ -1352,6 +1353,26 @@ class KeyTargetingTest(fixtures.TablesTest):
|
|||
cls.tables.keyed4.insert().execute(dict(b="b4", q="q4"))
|
||||
cls.tables.content.insert().execute(type="t1")
|
||||
|
||||
|
||||
@testing.requires.schemas
|
||||
@testing.provide_metadata
|
||||
def test_keyed_accessor_wschema(self):
|
||||
keyed1 = Table('wschema', self.metadata,
|
||||
Column("a", CHAR(2), key="b"),
|
||||
Column("c", CHAR(2), key="q"),
|
||||
schema="test_schema"
|
||||
)
|
||||
keyed1.create(checkfirst=True)
|
||||
keyed1.insert().execute(dict(b="a1", q="c1"))
|
||||
|
||||
row = testing.db.execute(keyed1.select()).first()
|
||||
|
||||
eq_(row.b, "a1")
|
||||
eq_(row.q, "c1")
|
||||
eq_(row.a, "a1")
|
||||
eq_(row.c, "c1")
|
||||
|
||||
|
||||
def test_keyed_accessor_single(self):
|
||||
keyed1 = self.tables.keyed1
|
||||
row = testing.db.execute(keyed1.select()).first()
|
||||
|
|
Loading…
Reference in New Issue