diff options
| author | Catherine Devlin <catherine.devlin@gmail.com> | 2008-03-19 22:53:31 +0000 |
|---|---|---|
| committer | Catherine Devlin <catherine.devlin@gmail.com> | 2008-03-19 22:53:31 +0000 |
| commit | 04b81eecbaffab7da22289391009b8323b5fa000 (patch) | |
| tree | 995f3b4218a09a59a76b75a2f4ba1a01146db774 | |
| parent | 8d0c5672f06952382b4eedf78158a043b3529878 (diff) | |
| download | sqlalchemy-04b81eecbaffab7da22289391009b8323b5fa000.tar.gz | |
added a runtime-incrementing counter for default primary keys to testlib/schema for Oracle
| -rw-r--r-- | test/testlib/schema.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/testlib/schema.py b/test/testlib/schema.py index 152660380..7f6370482 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) |
