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, backref='contact', 
passive_deletes=True)

form_exists = column_property(
        exists().where(and_( FormContact .form_contact_id == id,
                            FormContact.partnership_id == partnership_id
                            )).label('form_contact_exist'), deferred=True
    )
*prints out to be something like:*
exists(select * from form_contacts where form_contacts.form_contact_id == 
id and  form_contacts. partnership_id == partnership_id)

Does the exists "stop" the query once one row is returned or does it 
execute the entire select all query?
If the latter, is there a way to limit the select all to one row?

Regards,
Justin

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/17fa3686-6e58-4198-869d-88b40dc02448n%40googlegroups.com.

Reply via email to