Sorry!

Nevermind, your link answers that question.

Thanks.

On Mar 26, 4:23 pm, Kent Bower <k...@retailarchitects.com> wrote:
> Thanks for the info.
>
> Since it is NOCYCLE in oracle and NO CYCLE in postgres, I would check
> the engine.dialect.name in the compile, method correct?
>
>                      if eng.dialect.name == 'oracle':
>                          sql += " NOCYCLE"
>                      elif eng.dialect.name == 'postgres':
>                          sql += " NO CYCLE"
>                      else:
>                          raise Exception("RSequence is only implemented
> for Oracle and PostgreSQL!")
>
> How do I get a hold of the engine from within a Sequence object?
>
> On 3/26/2010 2:26 PM, Michael Bayer wrote:
>
> > Kent wrote:
>
> >> Any plans to support MINVALUE, MAXVALUE, CYCLE, NOCYCLE for sequences
> >> (for both postgres and oracle)?
>
> >> I've implemented a subclass of Sequence myself, but it isn't very
> >> elegant, because I'm not familiar enough with the code to know which
> >> methods to override for create() output.
>
> > correction:  redefine the compilation for CreateSequence:
>
> > from sqlalchemy import *
> > from sqlalchemy import schema
> > from sqlalchemy.ext.compiler import compiles
>
> > class MySeq(Sequence):
> >      def __init__(self, *args, **kw):
> >          self.cycle = kw.pop('cycle', False)
> >          super(MySeq, self).__init__(*args, **kw)
>
> > @compiles(schema.CreateSequence)
> > def compile(element, compiler, **kw):
> >      if isinstance(element.element, MySeq):
> >          return "CREATE SEQUENCE %s %s" % (element.element.name,
> > element.element.cycle and "CYCLE" or "")
> >      else:
> >          return compiler.visit_create_sequence(element)
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "sqlalchemy" group.
> >> To post to this group, send email to sqlalch...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> sqlalchemy+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/sqlalchemy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to