Re: [sqlalchemy] Passing reference to model to model column_property function

2020-05-18 Thread Erol Merdanović
from database and not from python method. Can I force hybrid_method to always get a value from database? On Sunday, 17 May 2020 16:37:25 UTC+2, Mike Bayer wrote: > > > > On Sun, May 17, 2020, at 6:54 AM, Erol Merdanović wrote: > > Hi > > First thank you for your reply

Re: [sqlalchemy] Passing reference to model to model column_property function

2020-05-17 Thread Erol Merdanović
Hi First thank you for your reply. @Mike, yes. I wish to pass the row products row. I'm attaching working SQL SELECT *, get_product_price(products) FROM products; This works great in postgres. I tried it also on Mysql but they support only scalar values. I suspect that might work with other

[sqlalchemy] Passing reference to model to model column_property function

2020-05-16 Thread Erol Merdanović
Hi I have a model definition class Product(db.Model): __tablename__ = "products" id = db.Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) sku = db.Column(db.String(255), nullable=False, unique=True, index=True) Product.base_price = column_property(

Re: [sqlalchemy] (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back

2018-03-07 Thread Erol Merdanović
;, line 1114, in _execute_context conn = self._revalidate_connection() File "sqlalchemy/engine/base.py", line 424, in _revalidate_connection "Can't reconnect until invalid " On Wednesday, 7 March 2018 15:02:04 UTC+1, Mike Bayer wrote: > > SQLAlchemy generates th

[sqlalchemy] (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back

2018-03-07 Thread Erol Merdanović
Hello I'm using latest sqlalchemy (this was also occurring with 1.1.x branch) with flask and flask-sqlalchemy. For some reason I'm randomly getting this error. 1. Checking the group there were similar problems but some mentioned that problem is with database going away 2. Others mentioned

[sqlalchemy] Re: Join on filter for chained loads

2018-01-07 Thread Erol Merdanović
Hello Jonathan Yes, I was suspecting that aliased was the solution but wasn't sure if it's the correct approach. It works, thank you for your help! On Saturday, 6 January 2018 18:52:54 UTC+1, Jonathan Vanasco wrote: > > use `sqlalchemy.orm.aliased` to create an alias of A for your join >

[sqlalchemy] Join on filter for chained loads

2018-01-05 Thread Erol Merdanović
Hi I have following relation A -> B (with filter) A -> C -> A -> B (with filter) and I want to load this in one query session.Query(A).join(A.b, and_(A.id == B.parent_id, B.field == 123)). options(contains_eager(A.b), joinedload(A.c).joinedload(C.a).joinedload(A.b )) how could I provide