Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-09 Thread Jonathan Vanasco
On Friday, January 6, 2017 at 7:47:17 PM UTC-5, Daniel Kraus wrote: > > > If I'm reading your question correctly, most of what sqlalchemy does > (and > > excels at) is specifically keeping people from doing what you're trying > to > > do. > > I think you got me wrong then. > > > It seems

Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-07 Thread Chris Withers
On 07/01/2017 00:20, Daniel Kraus wrote: 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

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] Load sqlalchemy orm model from dict

2017-01-05 Thread Daniel Kraus
Hi! I don't even quote my old message since it's just confusing. In my head the question made sense ;) So I try again with a code example: I have a class `User`: #+BEGIN_SRC python class User(Base): id = Column(Integer, primary_key=True) name = Column(String(64)) email =

Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-05 Thread mike bayer
On 01/03/2017 03:10 AM, Daniel Kraus wrote: Hi, how can I load a sqlalchemy orm model from a dictionary? Let's say I have a `User` model with attributes `id`, `name`, `email` and a relationship `languages`. I have a dict with `id`, `name`, `email` from users in my cache, but not `languages`

[sqlalchemy] Load sqlalchemy orm model from dict

2017-01-03 Thread Daniel Kraus
Hi, how can I load a sqlalchemy orm model from a dictionary? Let's say I have a `User` model with attributes `id`, `name`, `email` and a relationship `languages`. I have a dict with `id`, `name`, `email` from users in my cache, but not `languages` that's rarely used. Is it possible to create a