On Sun, Dec 6, 2009 at 12:21 AM, James Henstridge <[email protected]> wrote:

> Well, if you are writing an application for Oracle, you could always
> do something like this:
>
> class Foo(object):
>    __storm_table__ = 'foo'
>    foo_pk = Int(primary=True, default=Nextval('foo_seq'))
>
> Where Nextval is an expression class that compiles to the right
> syntax.  If you've got access to an "INSERT ... RETURNING ..." style
> statement to retrieve the allocated primary key, then that might be
> enough.

We need Foo to work with other database backends, too, not just
Oracle; having a default in the context of MS SQL, even if the MSSQL
backend compiled Nextval to empty string, would cause syntax errors
for MS SQL.

It looks like the SQLAlchemy solution to this is to provide a special
'sequence' parameter for column declarations, which would be ignored
by backends which don't have sequences.

Table('sometable', metadata,
        Column('id', Integer, Sequence('some_id_seq'), primary_key=True)
    )

I think it would make sense to add something like this to Storm.

-- 
storm mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/storm

Reply via email to