Hi!

I'm trying to filter my data by some date calculations.
In detail, I want to filter out messages that have been marked as
"deleted" more than 30 days ago.

In a query I could do it like this:

    threshold = datetime.now() - datetime.timedelta(30)
    return Message.query().filter(Message.deleted > threshold).all()

But how can I do it in a relation() that returns all deleted messages?
I'd have to calculate the threshold on every call to the relation or
I'd have to create a query that will do the calculation in SQL.
For both options I don't know how I could accomplish it.

    messages_deleted=relation(
        Message,
        primaryjoin=and_(<conditions to create the relation>,
message_table.c.deleted > ????),
    ),

Any ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to