If anybody else is experience the same problem, I have opened a Bug
Request @ SQLA Trac, you can follow it through here:
http://www.sqlalchemy.org/trac/ticket/2260
On Aug 18, 1:56 am, Ygor Lemos opti...@gmail.com wrote:
Oh, sorry about that, I copied from a previous declaration I've been
If anybody else is experiencing this same problem, I have opened a Bug
Request @ SQLA Trac and you can follow it through here:
http://www.sqlalchemy.org/trac/ticket/2260
On Aug 18, 1:56 am, Ygor Lemos opti...@gmail.com wrote:
Oh, sorry about that, I copied from a previous declaration I've
Hi,
I started to play with events to port a library to sqla 0.7. I managed to
use
the 'listen' function but I failed on 'remove'. Looking at the signatures
they seem to be just the same, but here is what I get:
In [7]: event.listen(obj.__class__.title, 'set', listen_cb)
In [8]:
remove() isn't implemented yet.While the simple operation you see below
would be fine for a single listener on a single target, the targets we have
which propagate to subclasses (mapper events, attribute events) would require a
more elaborate system that can revisit everywhere the event has
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
On Aug 18, 2011, at 11:23 AM, Marc DellaVolpe wrote:
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 should have mentioned, I modified the CTE demo to work on SQL Server and I
believe (I will double check this...) that on SQL Server the with of the
CTE needs to be at the top of the statement and referenced in subqueries
below. The generated SQL SELECT FROM (WITH ...) is invalid on SQL
On Aug 18, 2011, at 11:56 AM, Marc DellaVolpe wrote:
I should have mentioned, I modified the CTE demo to work on SQL Server and I
believe (I will double check this...) that on SQL Server the with of the
CTE needs to be at the top of the statement and referenced in subqueries
below. The
Hi everyone, I'm trying to implement an InsertFromSelect workaround to
handle the identity insert issue of SQL server. This is more or less
what I'm doing:
class InsertFromSelect(Executable, ClauseElement) :
def __init__(self, table, select) :
self.table = table
self.select =
On Aug 18, 2011, at 12:24 PM, Massi wrote:
Hi everyone, I'm trying to implement an InsertFromSelect workaround to
handle the identity insert issue of SQL server. This is more or less
what I'm doing:
class InsertFromSelect(Executable, ClauseElement) :
def __init__(self, table, select) :
I changed the code to (SA 0.7.2 with pyodbc2.1.9):
class InsertFromSelect(Executable, ClauseElement) :
_execution_options =\
Executable._execution_options.union({'autocommit': True})
def __init__(self, table, select) :
self.table = table
self.select = select
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:
-- Works
WITH all_dates(date) AS (
SELECT CAST('2011-01-01' AS DATETIME) AS anon_1 UNION ALL SELECT DATEADD(dd,
1, date) AS DATEADD_1
FROM all_dates
WHERE
On Aug 18, 2011, at 1:06 PM, Massi wrote:
I changed the code to (SA 0.7.2 with pyodbc2.1.9):
class InsertFromSelect(Executable, ClauseElement) :
_execution_options =\
Executable._execution_options.union({'autocommit': True})
def __init__(self, table, select) :
self.table =
I got:
File C:\Python26\lib\site-packages\sqlalchemy-0.7.2-py2.6-win32.egg
\sqlalchemy\engine\base.py, line 2285, in execute
return connection.execute(statement, *multiparams, **params)
File C:\Python26\lib\site-packages\sqlalchemy-0.7.2-py2.6-win32.egg
\sqlalchemy\engine\base.py, line
There seems to be a problem with the custom compilation.
print Session.query(Date).order_by(Date.date.desc())
WITH all_dates(date) AS (
SELECT CAST(:start AS DATETIME) AS anon_1 UNION ALL SELECT DATEADD(dd,
:step, date) AS DATEADD_1
FROM all_dates
WHERE DATEADD(dd, :step, date) = CAST(:stop AS
On Aug 18, 2011, at 1:19 PM, Massi wrote:
I got:
File C:\Python26\lib\site-packages\sqlalchemy-0.7.2-py2.6-win32.egg
\sqlalchemy\engine\base.py, line 2285, in execute
return connection.execute(statement, *multiparams, **params)
File
On Aug 18, 2011, at 1:28 PM, Marc DellaVolpe wrote:
There seems to be a problem with the custom compilation.
print Session.query(Date).order_by(Date.date.desc())
WITH all_dates(date) AS (
SELECT CAST(:start AS DATETIME) AS anon_1 UNION ALL SELECT DATEADD(dd, :step,
date) AS DATEADD_1
I understand what you are saying about this being an uphill battle on mssql.
If we ignore the CTE for the moment and pretend that all_dates is a regular
table, shouldn't there be no difference for generation. You can subquery
as needed and all that really needs to happen is to prepend the CTE
Hello,
I have found a case where instantiating a select statement during the
declaration of the parent class in a one-to-many pair can cause a
downstream failure to generate well formed sql when performing a query
with a subqueryload option. I've boiled down a minimal example
(pasted below) which
the issue is quite simple as can be seen in this demonstration:
from sqlalchemy import *
# two columns. Nothing up my sleeve !
c1 = Column('c1', Integer)
c2 = Column('c2', Integer)
# put one of them into a Select.
# generate _from_objects collection of c1 too early
s = select([c1])
t =
On Aug 18, 2011, at 4:24 PM, Michael Bayer wrote:
However, the original select() is still wrong. _from_objects gave it the
wrong data, period.How to guard against this issue, a potentially
expensive reorg of Select internals. As well as future issues of this sort,
using Column
On 18 Ago, 16:52, Michael Bayer mike...@zzzcomputing.com wrote:
remove() isn't implemented yet. While the simple operation you see below
would be fine for a single listener on a single target, the targets we have
which propagate to subclasses (mapper events, attribute events) would
I want to create a table that has several similar fields. For example, assume
the fields are field1, field2, ...
Is there a way in the declarative class that I can do something like:
for i in range(10):
'field%d' % i = Column( ... )
Thanks,
Mark
--
You received this message because
On Aug 18, 2011, at 6:06 PM, Mark Erbaugh wrote:
want to create a table that has several similar fields. For example, assume
the fields are field1, field2, ...
Is there a way in the declarative class that I can do something like:
for i in range(10):
'field%d' % i = Column( ... )
Me again (see below):
On Aug 18, 2011, at 7:01 PM, Mark Erbaugh wrote:
On Aug 18, 2011, at 6:06 PM, Mark Erbaugh wrote:
want to create a table that has several similar fields. For example, assume
the fields are field1, field2, ...
Is there a way in the declarative class that I can do
25 matches
Mail list logo