[sqlalchemy] Re: SQL Alchemy TypeDecorator

2022-08-09 Thread 'Jonathan Vanasco' via sqlalchemy
This is usually done in the ORM with functions, and possibly hybrids. See https://docs.sqlalchemy.org/en/14/orm/mapped_attributes.html On Tuesday, August 9, 2022 at 1:55:45 PM UTC-4 Justvuur wrote: > Hi there, > > Is there a way to pass/access model data for a row within the " >

[sqlalchemy] Re: SQLAlchemy exists() used with first() ?

2022-08-09 Thread 'Jonathan Vanasco' via sqlalchemy
I think you misunderstand `exists()` in SQLAlchemy and SQL. `exists()` is a convenience function to create a SQL `EXISTS` clause, which is an operator used for filtering subqueries. The 'from_exists' is just a subquery. It is supposed to be used within a query which would then limit the

[sqlalchemy] SQLAlchemy exists() used with first() ?

2022-08-09 Thread Justvuur
Hi there, When creating another column property in a model that makes use of the exists(), I noticed that the exists does a "select *". *For example, the form exists below:* class Contact(ResourceMixin, db.Model): __tablename__ = 'contacts' form_contacts = db.relationship(FormContact,

[sqlalchemy] SQL Alchemy TypeDecorator

2022-08-09 Thread Justvuur
Hi there, Is there a way to pass/access model data for a row within the " process_result_value" method of a TypeDecorator? For example, I want to decrypt the value but only if another value in the same model row is true/false. Regards, Justin -- SQLAlchemy - The Python SQL Toolkit and