Re: [sqlalchemy] Re: set next value of postgres sequence

2015-12-01 Thread Jonathan Vanasco


On Tuesday, December 1, 2015 at 3:39:02 PM UTC-5, Chris Withers wrote:
>
> Indeed, but that's not quite what I asked ;-)
>
> I'm after setting the next value using, eg, setval:
>
>
Ah, sorry.  I saw "next value" and thought "nextval", not setval.   

The `Sequence` object just seems to support a 
'next_value()' 
http://docs.sqlalchemy.org/en/latest/core/defaults.html#sqlalchemy.schema.Sequence

I looked in the source, and it looks like the postgres dialect only has a 
`nextval` operation.  Sqlalchemy's compiler and dialects seem to only 
support `create sequence` and `nextval` (there's no "alter sequence 
[restart with]" or "setval" equivalents).   It looks like you can only pass 
in a start value for the sequence on creation.

I think you may need to handle this with literal sql, and create a ticket 
or try to patch.  

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: set next value of postgres sequence

2015-12-01 Thread Chris Withers

Indeed, but that's not quite what I asked ;-)

I'm after setting the next value using, eg, setval:

http://www.postgresql.org/docs/current/static/functions-sequence.html

...or to do it on creation of the sequence:

http://www.postgresql.org/docs/current/static/sql-createsequence.html

I guess this might come into the stuff I was asking about in the 
"non-table DDL elements and MetaData objects" thread.


Chris

On 28/11/2015 18:04, Jonathan Vanasco wrote:

There is a `Sequence` object that can be delcared like a table

From the docs:

http://docs.sqlalchemy.org/en/latest/core/defaults.html#defining-sequences

seq  =  Sequence('some_sequence')
nextid  =  connection.execute(seq)
--
You received this message because you are subscribed to the Google 
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to sqlalchemy+unsubscr...@googlegroups.com 
.
To post to this group, send email to sqlalchemy@googlegroups.com 
.

Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
__


--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: set next value of postgres sequence

2015-11-28 Thread Jonathan Vanasco
There is a `Sequence` object that can be delcared like a table

>From the docs:

http://docs.sqlalchemy.org/en/latest/core/defaults.html#defining-sequences

seq = Sequence('some_sequence')nextid = connection.execute(seq)

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.