Re: [sqlalchemy] Load sqlalchemy orm model from dict

2017-01-06 Thread Daniel Kraus
Jonathan Vanasco <jvana...@gmail.com> 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. >

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-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 =

[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

Re: [sqlalchemy] prefix_with for queries with that eager load relationships

2016-02-25 Thread Daniel Kraus
On Tuesday, 23 February 2016 23:16:25 UTC+8, Mike Bayer wrote: > > > On 02/23/2016 04:00 AM, Daniel Kraus wrote: > > Here is a simple script to demonstrate the error: > > > > https://gist.github.com/dakra/0424086f5837d722bc58 > > the joinedload() case "

[sqlalchemy] prefix_with for queries with that eager load relationships

2016-02-23 Thread Daniel Kraus
Hi, I want to use mysqls `SQL_CALC_FOUND_ROWS` but when I use `query.prefix_with(...)` it fails when the query eager loads a relationship because sqlalchemy puts the prefix not at the beginning. I'm not sure if I should file a bug report or if it's intended behaviour. If I'm doing something

[sqlalchemy] Connecting to ms sql db on Windows Server 2008 with pyodbc and python 3.3

2013-03-07 Thread Daniel Kraus
Hi, when I try to connect with sqlalchemy and mssql+pyodbc I get this exeption: TypeError: The first argument to execute must be a string or unicode query. It works if I only use pyodbc. E.g. conn = pyodbc.connect('DRIVER={SQL Server};Server=127.0.0.1;Database=BOM;UID=guest;PWD=guest')