On Apr 25, 2013, at 9:26 PM, Pedro Werneck wrote:
>
>
> So, basically it's just passing the eventlet pool as the creator for the
> create_engine call? Good.
>
> Right, it isn't critical at all. My system is working perfectly fine and much
> faster than without eventlets most of the time, bu
On Thursday, April 25, 2013 7:06:31 PM UTC-3, Michael Bayer wrote:
>
>
> On Apr 25, 2013, at 2:15 PM, Pedro Werneck >
> wrote:
>
>
>
> I'm using SQLAlchemy with MySQLdb for processing dozen million daily tasks
> with Celery. Most of my queries are very quick and the tasks don't wait for
> I/O
When you say you created a setup fixture but it didn't work, what
didn't work exactly?
For example, if you just did something like this:
def setup():
engine = ...
Session = ...
session = Session()
...then that won't work because session is a local variable inside the
setup fu
I may have come up with a really great solution for all of this, if you'd like
to try the branch I have at https://bitbucket.org/zzzeek/sa_2714 - all the
original use cases seem to be working.
I'll be testing this branch over the next day or so and will have it committed
soon. 0.8.1 is also du
On Apr 25, 2013, at 10:21 AM, Andi Blake wrote:
> hi all,
>
> i have a webapp with an existing database-model ``site``, including users. in
> a second service i create a new database-model ``market``, but still want to
> access the users (which works via separate engine).
>
> goal: i want t
Hmm, I was thinking in labeling this evening. I'll try tomorrow when
I get to work and then try this alternative. Maybe it works and avoids
my workaround :)
Thanks Mike.
Best regards,
Richard.
Em
2013-04-25 19:20, Michael Bayer escreveu:
> using explicit labels is
the best approach to
On Apr 25, 2013, at 4:31 PM, Joril wrote:
> Hi everyone!
> I have this working query:
>
> select *
> from A join B on A.id = B.a_id
> where exists (select 1 from C where A.id = C.a_id and C.value > B.value)
>
> and I tried to implement it like this:
>
> q = Session.query(entities.A)
> q = q.j
using explicit labels is the best approach to bypass SQLA's labeling schemes,
such as this example:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Int
On Apr 25, 2013, at 2:59 PM, sajuptpm wrote:
> Hi,
>
> I have a locking system like this
>
> class LockManager:
> def get_lock(self, id):
> lock_m=DBSession.query(Locker).with_lockmode("update").\
> filter(Locker.id==id).all()
> if len(lock_m) == 0:
>
On Apr 25, 2013, at 2:43 PM, sajuptpm wrote:
> Hi,
>
> Suppose we have two transactions T1 and T2. Both transactions trying to
> update same row ROW1.
>
> Suppose both transactions are started simultaneously.
>
> T1 first updated ROW1 and commit it.
>
> In my case T2 not getting the update
On Apr 25, 2013, at 2:15 PM, Pedro Werneck wrote:
>
>
> I'm using SQLAlchemy with MySQLdb for processing dozen million daily tasks
> with Celery. Most of my queries are very quick and the tasks don't wait for
> I/O for too long, so I had great results using the eventlet pool for Celery.
> H
Hi everyone!
I have this working query:
select *
from A join B on A.id = B.a_id
where exists (select 1 from C where A.id = C.a_id and C.value > B.value)
and I tried to implement it like this:
q = Session.query(entities.A)
q = q.join((entities.B, entities.A.id == entities.B.a_id))
q = q.filter(en
Hi,
I have a locking system like this
class LockManager:
def get_lock(self, id):
lock_m=DBSession.query(Locker).with_lockmode("update").\
filter(Locker.id==id).all()
if len(lock_m) == 0:
lm=Locker(id)
DBSession.add(lm)
def release_lock(
Hi,
Suppose we have two transactions T1 and T2. Both transactions trying to
update same row ROW1.
Suppose both transactions are started simultaneously.
T1 first updated ROW1 and commit it.
In my case T2 not getting the update done by T1.
If run commit in T2 and query ROW1 again, then I can s
I'm using SQLAlchemy with MySQLdb for processing dozen million daily tasks
with Celery. Most of my queries are very quick and the tasks don't wait for
I/O for too long, so I had great results using the eventlet pool for
Celery. However, whenever I hit a chunk of data which is expected to lead
Yeah, well, it is a select but didn't work. I also made another select
on top of it (to be sure), but the "error" persists (could not locate
column ...).
Nevermind about it, I think it's not a question of good usage of SA I
think :)
Thanks for your help!
Cheers,
Richard.
On 04/25/2013 01:
if the original "q" is a select(), this should work:
query(MyClass, q.c.somecol, q.c.someothercol).from_statement(q)
if not then I guess I'll screw around with it to see what works.
On Apr 25, 2013, at 10:37 AM, Richard Gerd Kuesters
wrote:
> Yup, I agree with you, but things are a little o
Yup, I agree with you, but things are a little out of hand for me to use
ORM-level queries. I'll see what I can do ...
Thanks! :)
Cheers,
Richard.
On 04/25/2013 11:31 AM, Michael Bayer wrote:
you'd need to organize things differently for the column grabbing to
work out.
I'd advise producing
you'd need to organize things differently for the column grabbing to work out.
I'd advise producing the query using ORM-level Query in the first place so that
you don't need to use from_statement(), which is really a last resort system.
On Apr 25, 2013, at 10:27 AM, Richard Gerd Kuesters
wrot
Well, not the desired result ... Now things justs blows :-)
*sqlalchemy.exc.NoSuchColumnError: "Could not locate column in row for
column 'anon_1.level'"*
Cheers,
Richard.
On 04/25/2013 11:03 AM, Michael Bayer wrote:
why not just say session.query(MyObj, q.alias()) ?creating
ad-hoc
hi all,
i have a webapp with an existing database-model ``site``, including users.
in a second service i create a new database-model ``market``, but still
want to access the users (which works via separate engine).
goal: i want to create a relation from the ``market``-model to the
``site``-mo
Well. I'm pretty interested :) I did find your solution very flexible, thou.
Thanks a lot,
Richard.
On 04/25/2013 11:08 AM, Mariano Mara wrote:
On 04/25/2013 10:22 AM, Richard Gerd Kuesters wrote:
Hi all,
I've been playing with "sqla_hierarchy" from
https://github.com/marplatense/sqla_hierar
On 04/25/2013 10:22 AM, Richard Gerd Kuesters wrote:
Hi all,
I've been playing with "sqla_hierarchy" from
https://github.com/marplatense/sqla_hierarchy .
That code of that sqla_hierarchy was written to provide a limited
support for cte, from the time when sqalchemy didn't have cte.
Since sql
Hmmm ... Might as well :) I didn't know I could use an alias in
session.query. Thanks Mike!
Cheers,
Richard.
On 04/25/2013 11:03 AM, Michael Bayer wrote:
why not just say session.query(MyObj, q.alias()) ?creating
ad-hoc mappers is relatively expensive.
On Apr 25, 2013, at 8:56 AM,
the columns come out in order because they have a "creation order" counter
running that tracks the order in which each object was created.There's
nothing like that built into @declared_attr, I guess if it produces an object
reference we could add the creation counter to it as well.
On Apr 2
why not just say session.query(MyObj, q.alias()) ?creating ad-hoc
mappers is relatively expensive.
On Apr 25, 2013, at 8:56 AM, Richard Gerd Kuesters
wrote:
> Well, probably nevermind because I made a workaround that satisfies me (may
> not be elegant, but that's OK).
>
> Basically
Minor tweaks, may it be useful for someone:
*q1 = hierarchy_query.alias('q1')**
**s = select(**
**[q1.c.id, q1.c.level, q1.c.is_leaf, q1.c.connect_path],**
**from_obj=q1**
**).alias('o')**
**MyObjExt = type('MyObjExt', (Base,), {'__table__': s})**
**
# objects :)
rs = object_session(self)
Well, probably nevermind because I made a workaround that satisfies me
(may not be elegant, but that's OK).
Basically, I created the "o" type a little different: "o =
type('MyObjExt', (Base,), {'__table__':q.alias('q')})" and append it to
the query like: "session.query(MyObj, o).from_statement
Hi all,
I've been playing with "sqla_hierarchy" from
https://github.com/marplatense/sqla_hierarchy .
The problem is: the returned query appends 3 columns: level (Integer),
is_leaf (Boolean) and connect_path (pg ARRAY).
So far, so good. If I execute the query using
"session.execute(q).fetch
Hi All,
I didn't see anything in the code that could help here (except maybe
__declare_last__, but that looks like something else) but thought I'd
ask in case I'm missing something...
So, some of my mixins include columns that logically come later than the
columns defined in the class using
30 matches
Mail list logo