Re: [sqlalchemy] Issue with relations on postgres timestamps with the value "-infinity"

2017-10-27 Thread Michel Albert
Thanks for the quick update. I did not have the reflex to look into psycopg2 for this. But indeed, a custom SA type would help here too. On Thursday, 26 October 2017 17:46:29 UTC+2, Mike Bayer wrote: > > On Thu, Oct 26, 2017 at 11:16 AM, Michel Albert <exh...@gmail.com > > wrote

[sqlalchemy] Issue with relations on postgres timestamps with the value "-infinity"

2017-10-26 Thread Michel Albert
I've run into an issue with tables containing the special "-infinity" value in postgres. More precisely, when resolving relations on such tables. SQLAlchemy will convert the value "-infinity" into "datetime(1, 1, 1, 0 , 0)" and try to find rows in the related table with that value. This will

[sqlalchemy] Unit testing, mocking and dependency injection with SA Declarative.

2013-09-10 Thread Michel Albert
I am trying to wrap my head around how to do Dependency Injection with SQLAlchemy and I am walking in circles. I want to be able to mock out SA for most of my tests. I trust SA and don't want to test serialisation into the DB. I just want to test my own code. So I was thinking to do dependency

[sqlalchemy] Do not add entities automatically to the session?

2013-07-22 Thread Michel Albert
Hi, I realised that SA adds an instance to the session as soon as I instantiate it. How/Where can I disable this? For example: currently I have this behaviour: session = get_session() my_user = User(email='f...@example.com') len(session.query(User)) 1 but instead I would like to have the

[sqlalchemy] Re: strange attributeerror module object has no attribute exc when using sqlalchemy from a mod_wsgi handle

2012-06-12 Thread Michel Albert
On Tuesday, 27 March 2012 23:39:11 UTC+2, alonn wrote: this is what I got from tailing the mod_wsgi error stack: [Tue Mar 27 23:14:16 2012] [error] [client 127.0.0.1] from sqlalchemy import create_engine,String,Unicode,Integer, Column, func,distinct, desc [Tue Mar 27 23:14:16 2012]

[sqlalchemy] Re: strange attributeerror module object has no attribute exc when using sqlalchemy from a mod_wsgi handle

2012-06-12 Thread Michel Albert
On Tuesday, 12 June 2012 15:31:26 UTC+2, Michel Albert wrote: On Tuesday, 27 March 2012 23:39:11 UTC+2, alonn wrote: this is what I got from tailing the mod_wsgi error stack: [Tue Mar 27 23:14:16 2012] [error] [client 127.0.0.1] from sqlalchemy import create_engine,String,Unicode

[sqlalchemy] Re: Referential integrity actions are not doing what I want

2010-06-26 Thread Michel Albert
On Jun 22, 4:07 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 22, 2010, at 9:27 AM, exhuma.twn wrote: Hi, I have a table of items, where each item can be owned by one person, and held by someone else. I want the owner to be compulsory (not nullable), and the holder to be