[storm] Sequence support in Storm
James Henstridge
james at jamesh.id.au
Thu Apr 16 02:20:17 BST 2009
On Thu, Apr 16, 2009 at 5:27 AM, Baiju M <mbaiju at zeomega.net> wrote:
> Hi,
> I want to use sequence object support provide by Oracle with Storm.
> I found an API to support it and implemented in PostgreSQL backed.
>
> The API is like this:
>
> id = Int(primary=True, default=Sequence("person_seq"))
>
> I just added this to Oracle backend (based on PostgreSQL backend):
>
> @compile.when(Sequence)
> def compile_sequence_oracle(compile, sequence, state):
> return "%s.NEXTVAL" % sequence.name
>
> And I got the sequence working.
>
> Now how can we ignore this "default sequence" from other backends.
> So, that I can use the same schema with two (or more) backends.
> Currently I want use this with MS SQL.
Given that Oracle seems to support an "INSERT ... RETURNING ..."
statement, it'd probably be better to try and get that working. That
would handle all server allocated values (sequences, triggers, etc)
with only a single query. We prefer it for PostgreSQL over the
nextval(sequence) stuff for the same reasons.
James.
More information about the storm
mailing list