non_1 UNION ALL SELECT DATEADD(dd, ?, date)
AS [DATEADD_1]
FROM all_dates
WHERE DATEADD(dd, ?, date) <= CAST(? AS DATETIME)
)
SELECT date AS date
FROM (SELECT * FROM all_dates) as x
WHERE date>='2011-01-15 00:00:00' ORDER BY date DESC
OPTION (MAXRECURSION 0)
On Thu, Aug 18, 2011 at
used a regular expression to shim in a special comment. This
seems hackish but could a similar approach work on mssql? Is it possible to
hook into only the top-level/last Select's compile()?
Thanks for all of your help.
-Marc
On Thu, Aug 18, 2011 at 1:37 PM, Michael Bayer wrote:
>
> On Aug
step, date) <= CAST(:stop AS DATETIME)
)
SELECT * FROM all_dates
OPTION (MAXRECURSION 0)
On Thu, Aug 18, 2011 at 1:08 PM, Marc DellaVolpe
wrote:
> From what I can tell from
> http://msdn.microsoft.com/en-us/library/ms190766.aspx and experimentally,
> you can only put CTE's at the top
a CTE to the select and then generating
custom SQL for the subclass but I wasn't completely familiar of the
compilation workings to determine if this was workable solution to force the
CTE to the top of the generated SQL.
-Marc
On Thu, Aug 18, 2011 at 12:13 PM, Michael Bayer wrote:
>
>
"DATEADD_1"
FROM all_dates
WHERE DATEADD(dd, %(step)s, all_dates.date) <= CAST(%(stop)s AS TIMESTAMP
WITHOUT TIME ZONE))
SELECT anon_1.date AS anon_1_date
FROM (SELECT * FROM all_dates) AS anon_1
-Marc
On Thu, Aug 18, 2011 at 11:47 AM, Michael Bayer wrote:
>
> On Aug 18, 2011, a
I found the following CTE demo (http://www.sqlalchemy.org/trac/
attachment/ticket/1859/cte_demo.py) and I was wondering if there was
any way to map these selects.
I have built a CTE based select to generate a dates table on the fly
and I would love to be able to map this and use generative selects