From 04b81eecbaffab7da22289391009b8323b5fa000 Mon Sep 17 00:00:00 2001 From: Catherine Devlin Date: Wed, 19 Mar 2008 22:53:31 +0000 Subject: [PATCH] added a runtime-incrementing counter for default primary keys to testlib/schema for Oracle --- test/testlib/schema.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/testlib/schema.py b/test/testlib/schema.py index 152660380a..7f6370482f 100644 --- a/test/testlib/schema.py +++ b/test/testlib/schema.py @@ -1,4 +1,5 @@ from testlib import testing +import itertools schema = None __all__ = 'Table', 'Column', @@ -54,6 +55,8 @@ def Table(*args, **kw): return schema.Table(*args, **kw) +generic_counter = itertools.count() + def Column(*args, **kw): """A schema.Column wrapper/hook for dialect-specific tweaks.""" @@ -61,6 +64,8 @@ def Column(*args, **kw): if schema is None: from sqlalchemy import schema - # TODO: a Column that creates a Sequence automatically for PK columns, - # which would help Oracle tests + if testing.against('oracle'): + if kw.get('primary_key') == True and kw.get('default') == None: + kw['default'] = generic_counter.next + return schema.Column(*args, **kw) -- 2.47.3