Re: [sqlalchemy] Mixed data type for a column

2015-09-17 Thread Mattias Lagergren
Hi Michael, Thank you for your quick reply and clarifying both SqlAlchemy and the SQL-side. Also, the mixing of SQL-side CAST with a SQL column that is essentially > just a string is not correct. On the SQL side, operations with this column > all deal with the same type (string) so there's

Re: [sqlalchemy] AttributeError: 'NoneType' object has no attribute 'accepts_scalar_loader'

2015-09-17 Thread Mike Bayer
On 9/16/15 8:05 PM, dewey wrote: Hey Mike, I've found and fixed (with help) my problem, but I thought I'd describe it here to support anyone else who hits this... Was not a threading issue..it was a combination of: * data-edge case * bug in our code * bug in how SA was reporting a

[sqlalchemy] expire_on_commit and relationships

2015-09-17 Thread Shimi Gersner
Hi Everyone, We are trying to switch to expire_on_commit=False in our project and our tests started to fail on the following scenario. Our best guess is that the attribute is lazy loaded on first access and it is not refresh/expired when the relationships change. Any good suggestions ? ##

[sqlalchemy] Re: expire_on_commit and relationships

2015-09-17 Thread Hagai Cohen
back_populate solves this. Full Example: from sqlalchemy import create_engine, Column, ForeignKey, Integerfrom sqlalchemy.ext.declarative import declarative_basefrom sqlalchemy.orm import relationship, sessionmaker Base = declarative_base() ## Modelclass Parent(Base): __tablename__ =

[sqlalchemy] create and update table dynamically in declarative base

2015-09-17 Thread Nana Okyere
I'm new to flask, python and sql alchemy. I'm using flask for a small application. Hence I'm using flask-sqlalchemy. I know it uses the declarative base. I have model.py as: from app import db > > >> >> def _create_db_sequence(name): > > # if db is Oracle create the sequence > > if

[sqlalchemy] Re: expire_on_commit and relationships

2015-09-17 Thread Jonathan Vanasco
Immediately I notice that the attributes `father`/`mother` have no relationship to the `Parent` object. I think specifying backref/back_populates should solve your issue: http://docs.sqlalchemy.org/en/rel_1_0/orm/backref.html Also, FYI You can use `expire` on just the relationships