From e9bbf54b715a3a07d18cdb663de18236ce6aea6a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 28 Mar 2007 23:30:22 +0000 Subject: [PATCH] added keys() to ColumnParameters, needed for setbindparamsizes traversal --- lib/sqlalchemy/sql.py | 5 ++++- test/sql/labels.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 9bdbc0cb8c..b9e9896a84 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -475,7 +475,10 @@ class ClauseParameters(object): bind = self.binds[key] value = self.binds_to_values[bind] return bind.typeprocess(value, self.dialect) - + + def keys(self): + return self.binds_to_names.values() + def __getitem__(self, key): return self.get_processed(key) diff --git a/test/sql/labels.py b/test/sql/labels.py index a2e899ed6e..53022a6a02 100644 --- a/test/sql/labels.py +++ b/test/sql/labels.py @@ -10,7 +10,7 @@ class LongLabelsTest(testbase.PersistTest): global metadata, table1 metadata = MetaData(engine=testbase.db) table1 = Table("some_large_named_table", metadata, - Column("this_is_the_primarykey_column", Integer, primary_key=True), + Column("this_is_the_primarykey_column", Integer, Sequence("this_is_some_large_seq"), primary_key=True), Column("this_is_the_data_column", String(30)) ) metadata.create_all() @@ -26,7 +26,7 @@ class LongLabelsTest(testbase.PersistTest): table1.insert().execute(**{"this_is_the_primarykey_column":3, "this_is_the_data_column":"data3"}) table1.insert().execute(**{"this_is_the_primarykey_column":4, "this_is_the_data_column":"data4"}) - r = table1.select(use_labels=True).execute() + r = table1.select(use_labels=True, order_by=[table1.c.this_is_the_primarykey_column]).execute() result = [] for row in r: result.append((row[table1.c.this_is_the_primarykey_column], row[table1.c.this_is_the_data_column])) @@ -35,7 +35,7 @@ class LongLabelsTest(testbase.PersistTest): (2, "data2"), (3, "data3"), (4, "data4"), - ] + ], repr(result) def test_colbinds(self): table1.insert().execute(**{"this_is_the_primarykey_column":1, "this_is_the_data_column":"data1"}) @@ -64,4 +64,4 @@ class LongLabelsTest(testbase.PersistTest): print str(x) if __name__ == '__main__': - testbase.main() \ No newline at end of file + testbase.main() -- 2.47.2