Hi all,
Is there a way to use generate_series with SQLAlchemy?

http://www.postgresql.org/docs/8.2/interactive/functions-srf.html

generate_series = select([column('i')],
    from_obj=[func.generate_series(bindparam('start'),
bindparam('end'))])

zrows = select([generate_series.params(start=1,
end=20).c.i]).label('series')

is the best stab I've made at it, but I don't actually understand the
syntax in the PGSQL docs:

select current_date + s.a as dates from generate_series(0,14,7) as
s(a);

That is how I'd like to use it, but I don't know how to translate
"s(a)/s.a" into SQLAlchemy.

As a side question, how would I add static columns to a select
statement? e.g. based on the pseudocode above:
zrows = select([generate_series.params(start=1, end=20).c.i], 0, 0,
0).label('series')
to add 3 columns of 0 value to each row generated.

Cheers
Luke

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

Reply via email to