I am new to sqlalchemy and I would like to begin using it to create scripts 
with some sql queries that I have been using but need to change from time 
to time. It would help a lot if someone could translate one of these 
queries to python sqlalchemy using an ORM (not simply executing the query 
as is) so that I could use this as a template for other queries, or at 
least learn from it.

One of my queries looks like this:

SELECT DISTINCT last_name, first_name, street_address, city, a.name, 
postal_code, f.name as country FROM db_contact c, db_entity_tag d , 
db_address e, db_state_province a, db_country f WHERE c.id = d.entity_id 
and tag_id = 6 and c.id = e.contact_id AND state_province_id = a.id  and 
e.country_id = f.id and  display_name not in ( SELECT display_name FROM 
db_contribution, db_contact c, db_entity_tag d WHERE receive_date > 
'2005-07-01' and contact_id = c.id and c.id = entity_id and tag_id = 6 )

Thanks for any help.

-- 
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/5f93d14e-f7cf-4434-a224-bfa411837927%40googlegroups.com.

Reply via email to