Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-23 Thread tonthon
. But I still have some transaction related errors. I'll continue my investigations and come back when I'll found the cause(s). Le 17/04/2019 à 16:26, Jonathan Vanasco a écrit : On Wednesday, April 17, 2019 at 4:36:30 AM UTC-4, tonthon wrote: May the scoped_session factory, used in both

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-17 Thread tonthon
/2019 à 15:41, Mike Bayer a écrit : On Tue, Apr 16, 2019 at 4:49 AM tonthon wrote: Celery tasks are using the same scoped_session factory, could it cause the errors we're facing here ? what's important is if these tasks run in the same process or not ? ( i thought celery runs as a separate

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-16 Thread tonthon
Celery tasks are using the same scoped_session factory, could it cause the errors we're facing here ? Le 15/04/2019 à 15:39, Mike Bayer a écrit : On Mon, Apr 15, 2019 at 5:41 AM tonthon wrote: I tried to set a lower value for the pool_recycle value and it seems to work. There is a celery

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-15 Thread tonthon
t actually scoped? On Fri, Apr 12, 2019 at 4:03 AM tonthon wrote: Le 10/04/2019 à 17:12, Mike Bayer a écrit : On Wed, Apr 10, 2019 at 9:23 AM tonthon wrote: Hi, We're using sqlalchemy in a Pyramid Web Application. We use the ZopeTransactionExtension and our session factory is initialized

Re: [sqlalchemy] Commands out of sync; you can't run this command now

2019-04-12 Thread tonthon
Le 10/04/2019 à 17:12, Mike Bayer a écrit : On Wed, Apr 10, 2019 at 9:23 AM tonthon wrote: Hi, We're using sqlalchemy in a Pyramid Web Application. We use the ZopeTransactionExtension and our session factory is initialized this way : DBSession = scoped_session(sessionmaker(extension

[sqlalchemy] Commands out of sync; you can't run this command now

2019-04-10 Thread tonthon
Hi, We're using sqlalchemy in a Pyramid Web Application. We use the ZopeTransactionExtension and our session factory is initialized this way : >>> DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) We use the pyramid_tm that wraps each web requests in a

Re: [sqlalchemy] Orm models, transaction and multiple binds

2019-01-14 Thread tonthon
It should solve my problem. I'm still amazed by the very high quality of this mailing-list. The answers are always targeting very precisely the solutions to the problems I'm sharing. Thanks a lot !! Le ven. 11 janv. 2019 à 20:45, Mike Bayer a écrit : > On Fri, Jan 11, 2019 at 1:19 PM tont

[sqlalchemy] Orm models, transaction and multiple binds

2019-01-11 Thread tonthon
Hi, We're using Sqlalchemy in a Pyramid web application, with the pyramid_tm package (a transaction that wraps every web request inside a DB transaction). It's very usefull and it works like a charm. In order to follow some security rules and to be able to certify part of our app, we want to

Re: [sqlalchemy] Events and bidirectionnal datas modification

2018-02-08 Thread tonthon
Thanks a lot for this helpfull and precise answer. I'll tend to say "as usual" :). Have a nice day Gaston Le 07/02/2018 à 16:13, Mike Bayer a écrit : > On Wed, Feb 7, 2018 at 7:16 AM, tonthon <tontho...@gmail.com> wrote: >> Hi, >> >> I'd like to setu

Re: [sqlalchemy] Relationships - crash when class instantiation

2018-02-07 Thread tonthon
Hi, There's nothing that could cause the problem you describe in the example you provide maybe the guilty lines where not included. The easier way to go should be to step by step reproduce your model structure until you face the problem you describe and then post an example code : 

Re: [sqlalchemy] Help resolving Could not determine join condition between parent/child tables on relationship error message

2018-02-07 Thread tonthon
Hi, When SQALchemy can't guess the join condition to use for a relationship, you have to use the primaryjoin parameter : ursmst = relationship('Usrmst', primaryjoin="Workgrp.workgrp_owner==Usrmst.id") Hope this helps. Regards Gaston Le 07/02/2018 à 12:01, Jeremy Flowers a écrit : > Hi > I've

[sqlalchemy] Events and bidirectionnal datas modification

2018-02-07 Thread tonthon
Hi, I'd like to setup bidirectionnal data synchornization between the lastname attribute of two related models class User(Base):     __tablename__ = 'users'     id = Column(Integer, primary_key=True)     lastname = Column(String(50))     userdatas = relationship('UserDatas',

[sqlalchemy] deferred groups

2015-03-16 Thread tonthon
Hi, I'm using polymorphism and I set up some deferred columns at each level of inheritance belonging to the same deferred group : class Base(DBBASE): id = Column(Integer, primary_key=True) name = Column(String(255)) description = deferred( Column(Text()), group=full

Re: [sqlalchemy] deferred groups

2015-03-16 Thread tonthon
element.comments AS element_comments, element.id AS element_id, base.id AS base_id, base.name AS base_name, base.type_ AS base_type_ FROM base INNER JOIN element ON base.id = element.id Le 16/03/2015 17:33, tonthon a écrit : Sorry I was a bit too speed when writing that one :) So I've got a Base

Re: [sqlalchemy] deferred groups

2015-03-16 Thread tonthon
Thanks a lot for the time you spent on my question (and for the answer). I'll try to make it directly clear next time. Regards Le 16/03/2015 17:49, Michael Bayer a écrit : tonthon tontho...@gmail.com wrote: Sorry, still a few mistakes in what I wrote (first testing what you paste is a far

Re: [sqlalchemy] deferred groups

2015-03-16 Thread tonthon
: tonthon tontho...@gmail.com wrote: Hi, I'm using polymorphism and I set up some deferred columns at each level of inheritance belonging to the same deferred group : class Base(DBBASE): id = Column(Integer, primary_key=True) name = Column(String(255)) description = deferred

[sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests : @region.cache_on_arguments() def get_my_model(id): return DBSession().query(Model).get(id) I retrieve models : model1 = get_my_model(5) model2 = get_my_model(5) model2 is

Re: [sqlalchemy] Handling detached instances

2014-09-30 Thread tonthon
Le mardi 30 septembre 2014 13:28:16 UTC+2, Simon King a écrit : On Tue, Sep 30, 2014 at 8:52 AM, tonthon tont...@gmail.com javascript: wrote: Hi, I'm using dogpile cache to store objects in a redis database, here's the sample function I use for my tests

[sqlalchemy] joined inheritance and cascading delete to relationship

2012-12-21 Thread tonthon
Hi, I've got a joined inheritance : class Task(Base): __tablename__ = 'task' id = Column(Integer, primary_key=True) class Invoice(Task): __tablename__ = 'invoice' id = Column(ForeignKey(task.id)) When I delete an invoice, the associated task is also deleted, that's ok. I've got a

Re: [sqlalchemy] with_polymorphic query and parent attribute filtering

2012-11-14 Thread tonthon
Le 14/11/2012 06:19, Michael Bayer a écrit : On Nov 13, 2012, at 3:34 AM, tonthon wrote: Hi, I'm using polymorphism for some of my models and I'm wondering how I should use the with_polymorphic query method. Consider the following: class A(Base): type_ = Column(Integer, nullable

[sqlalchemy] with_polymorphic query and parent attribute filtering

2012-11-13 Thread tonthon
Hi, I'm using polymorphism for some of my models and I'm wondering how I should use the with_polymorphic query method. Consider the following: class A(Base): type_ = Column(Integer, nullable=False) arg = Column(String(20)) __mapper_args__ = {'polymorphic_on': type_,

Re: [sqlalchemy] Issue with `filter_by`?

2012-07-25 Thread tonthon
what result do you get with : [obj.my_column for obj in Session.query(Model).filter_by(my_column=123).all()] ? Le 25/07/2012 07:17, Amos a écrit : I've defined a column declaratively like so my_column = Column(Unicode(30), index=True, unique=True) If I pass in an integer instead of a

[sqlalchemy] Sqlalchemy tuning : pool_size and pool_recycle

2012-06-29 Thread tonthon
Hi, I was wondering what values to setup for pool_size and pool_recycyle parameters. I think you have to set them up regarding your sql server configuration (mysql in my case), but how ? Cheers, Gaston -- You received this message because you are subscribed to the Google Groups sqlalchemy

Re: [sqlalchemy] Concrete inheritance and child relationship query

2012-06-29 Thread tonthon
Le 28/06/2012 16:40, Michael Bayer a écrit : On Jun 28, 2012, at 6:38 AM, tonthon wrote: Hi, I've got a problem understanding how to handle relationships with polymorphism Sorry for the db design (I took it overs as it is ). I've got a parent class Task class Task(DBBASE

[sqlalchemy] Aliased element and attributes

2012-06-29 Thread tonthon
Hi, I'm using the following (as discussed in another post) : p1 = aliased(Project) when using it in a filter : query = session.query(Task).with_polymorphic([Invoice, Estimation]).outerjoin(p1, Invoice.project).outerjoin(p2, Estimation.project) query = query.filter(p1.company_id==cid) I get

Re: [sqlalchemy] Concrete inheritance and child relationship query

2012-06-29 Thread tonthon
Le 29/06/2012 16:14, Michael Bayer a écrit : On Jun 29, 2012, at 6:31 AM, tonthon wrote: I had also to add : c1 = aliased(Client) c2 = aliased(Client) oh right, forgot that part query(Task).with_polymorphic([Invoice, Estimation]).outerjoin(p1, Invoice.project).outerjoin(p2

[sqlalchemy] Concrete inheritance and child relationship query

2012-06-28 Thread tonthon
Hi, I've got a problem understanding how to handle relationships with polymorphism Sorry for the db design (I took it overs as it is ). I've got a parent class Task class Task(DBBASE): __tablename__ = 'task' id = Column(Integer, primary_key=True) amount = Column(Integer) and two

Re: [sqlalchemy] Concrete inheritance and child relationship query

2012-06-28 Thread tonthon
Le 28/06/2012 16:40, Michael Bayer a écrit : On Jun 28, 2012, at 6:38 AM, tonthon wrote: Hi, I've got a problem understanding how to handle relationships with polymorphism Sorry for the db design (I took it overs as it is ). I've got a parent class Task class Task(DBBASE