Hi,
You won't be able to get() multiple objects at the same time.
query(SomeClass).get(pk1, pk2, pk3) takes in a tuple of values
representing the primary key of some record in your table. In this
case the primary key consists of three separate columns (thus a
composite key), though the record
Hi,
How can I build an ORM query using the sql OVERLAPS operator?
The overlaps operator can be expressed with the query:
SELECT *
FROM PERIOD
WHERE (P1_START P2_START AND (P1_START P2_FIN OR P1_FIN
P2_FIN)) OR
(P2_START P1_START AND (P2_START P1_FIN OR P2_FIN
P1_FIN)) OR
Hello.
I need to get query from sqlalchemy in json format.
query like
query_name = session.query(model.Users);
How to format like
{{id:1,name:Alex},{id:2,name:Nick}.}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 24.03.2009 13:45 Uhr, alex wrote:
Hello.
I need to get query from sqlalchemy in json format.
query like
query_name = session.query(model.Users);
How to format like
{{id:1,name:Alex},{id:2,name:Nick}.}
The result format does not
try somexpression.op('OVERLAPS', someotherexpression)
sagblmi wrote:
Hi,
How can I build an ORM query using the sql OVERLAPS operator?
The overlaps operator can be expressed with the query:
SELECT *
FROM PERIOD
WHERE (P1_START P2_START AND (P1_START P2_FIN OR P1_FIN
P2_FIN))
So I attempted to implement this, and I think I got perty close but
ended up getting stuck on trying to get the mapper working. Using SA
0.5.2 w/ psycopg2 2.0.9.
First I worked out the SQL for what I wanted and got this :
SELECT * FROM task
JOIN
( SELECT note_task.task_name,
you've got note.id AS id sneaking into your first subquery. this is
because your recent_task_notes is selecting it. if you mean for notes
to be in the FROM clause of that query, add correlate(None) to that
subquery.
David Gardner wrote:
So I attempted to implement this, and I think I got
Thats it! Thank you so much, I turned on the echo, and the SQL looks
exactly as I expected.
Michael Bayer wrote:
you've got note.id AS id sneaking into your first subquery. this is
because your recent_task_notes is selecting it. if you mean for notes
to be in the FROM clause of that query,
Thanks Michael for looking into it.
I've verified that I get the same results (works with 0.4.8,
rolls back with 0.5.2) on two additional Windows client
machines. Different OS's and python versions, so it's a
stable result on my end.
I'm not sure the best way to dig into this further. I'm
what if you create the same table on a totally new database and run it
there ?
davidlmontgomery wrote:
Thanks Michael for looking into it.
I've verified that I get the same results (works with 0.4.8,
rolls back with 0.5.2) on two additional Windows client
machines. Different OS's and
On Mar 24, 2:40 pm, Michael Bayer mike...@zzzcomputing.com wrote:
what if you create the same table on a totally new database and run it
there ?
Good idea. I'll try that momentarily.
In the meantime, I tried out wireshark and see that there
is a reliable difference in what is getting sent.
Oops, I messed up the 0.4.8 data as I was
cutting and pasting.
Corrected, actual data sent by 0.4.8:
Query: set implicit_transactions on
RPC Name: sp_datatype_info
Query: INSERT INTO sa_test (data, time) VALUES ('bingo',
'2009-03-24 15:08:12')
Query: IF @@TRANCOUNT 0 COMMIT
Actually there was a type-o in my mapper I had:
'LatestNote':relation(Note,secondary=recent_notes
when it should have been:
'LatestNote':relation(Note,secondary=recent_task_notes
No correlate(None) needed. As a side note adding correlate(None) caused
the relation to function when
ah. so thats a difference.ticket 1350 is added, we'll see what
the MS-SQL crew has to say.
On Mar 24, 2009, at 6:37 PM, davidlmontgomery wrote:
Oops, I messed up the 0.4.8 data as I was
cutting and pasting.
Corrected, actual data sent by 0.4.8:
Query: set
The relevant change is the addition of the
MSSQLDialect.do_begin method:
def do_begin(self, connection):
cursor = connection.cursor()
cursor.execute(SET IMPLICIT_TRANSACTIONS OFF)
cursor.execute(BEGIN TRANSACTION)
This was first introduced three months ago
to correct
yeah I know when it was done. we need Michael to fill in on that
detail.
On Mar 24, 2009, at 8:09 PM, davidlmontgomery wrote:
The relevant change is the addition of the
MSSQLDialect.do_begin method:
def do_begin(self, connection):
cursor = connection.cursor()
so in your app, you can do this for now to monkeypatch the problem away:
engine.dialect.do_begin = lambda *arg, **kw: pass
the current steps in do_begin() are probably needed for savepoint
support, though I might try myself at the pycon sprints to isolate
exactly why, and if so we'd have to
yeah I know when it was done. we need Michael to fill in on that
detail.
On Mar 24, 2009, at 8:09 PM, davidlmontgomery wrote:
The relevant change is the addition of the
MSSQLDialect.do_begin method:
def do_begin(self, connection):
cursor = connection.cursor()
Just a follow-up, the suggested work-around works great. I had to move the
column_properties outside the class definition for some of them to work,
but the final result works fine (classes not shown but the definitions are
pretty obvious):
def IF(condition, true, false):
Construct a simple
On Mar 24, 5:50 pm, Michael Trier mtr...@gmail.com wrote:
The way it is
structured now seems to work fine in all the tests, so it's odd that you're
having a problem. My only guess is that it's a TDS thing (I believe you
said you were using that). The odd thing is that the list of items
Jeez, yet another wonky mssql behavior switch? That things got more flags
than the U.N.
I believe that the MSSQL ODBC driver on Windows automatically sets
IMPLICIT_TRANSACTION
off on connect, whereas FreeTDS likely does not, which is perhaps the source
of the problem.
Here's what I think the
21 matches
Mail list logo