Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-06 Thread Daniel Kraus
Jonathan Vanasco writes: > On Thursday, January 5, 2017 at 8:34:52 PM UTC-5, Daniel Kraus wrote: >> >> The use-case is that I have a big model with lots of complex >> relationships but 90% of the time I don't need the data from those. > > If I'm reading your question

Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-06 Thread Daniel Kraus
Hi! mike bayer writes: > you're looking for session.merge() but if you're looking to save on a > SELECT you might also want to send in load=False - and if you are > starting with a fresh (non-pickled) object you probably need to call > make_transient_to_detached first

Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-06 Thread mike bayer
you're looking for session.merge() but if you're looking to save on a SELECT you might also want to send in load=False - and if you are starting with a fresh (non-pickled) object you probably need to call make_transient_to_detached first so that it acts like it was loaded from the database

Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-06 Thread Jonathan Vanasco
On Thursday, January 5, 2017 at 8:34:52 PM UTC-5, Daniel Kraus wrote: > > The use-case is that I have a big model with lots of complex > > relationships but 90% of the time I don't need the data from those. > If I'm reading your question correctly, most of what sqlalchemy does (and excels at)

Re: [sqlalchemy] combining DDL events -- bad practice?

2017-01-06 Thread mike bayer
why dont you aggregate all those functions into just one function? they are all on the same event after all. or have some kind of data structure that has all those functions and you loop through a list to register. lots of ways to make that be less code. On 01/06/2017 10:43 AM, Darin

[sqlalchemy] combining DDL events -- bad practice?

2017-01-06 Thread Darin Gordon
Is there a way to combine DDL events so to reduce the number of event.listen(... ) statements that need to be created for a specific event topic or is that a design mistake that has good reason for missing implementation? Take, for instance, the highlighted section of the following repo:

[sqlalchemy] Syntax for contained by DateRange

2017-01-06 Thread Alexander O'Donovan-Jones
Does anyone know what the syntax for using DateRanges is? I'm trying to find out if a given date falls within a range, and so thought that the `in` syntax in Python might work (to no avail): from psycopg2.extras import DateRange session.query(Order).filter(Order.created_at in DateRange(d1, d2,