[sqlalchemy] Re: SQLAlchemy does not always generate sequence for primary key field

2015-02-22 Thread Jan Murre
Seems that the difference in in the support for the smallserial datatype. This is not available for postgres 9.1.13: http://www.postgresql.org/docs/9.1/static/datatype-numeric.html Op zondag 22 februari 2015 09:23:38 UTC+1 schreef Jan Murre: I have the following model: class

[sqlalchemy] SQLAlchemy does not always generate sequence for primary key field

2015-02-22 Thread Jan Murre
I have the following model: class GeoLocation(Base): __tablename__ = geolocations id = Column(SmallInteger, primary_key=True) name = Column(String(8), nullable=False) coordinates = Column(String(80), nullable=False) Using SQLAlchemy 0.9.8 and postgresql 9.3.6 it

[sqlalchemy] Deleting from relationship

2015-02-22 Thread Asad Dhamani
I have a many-to-many relationship in my models. This is what they look like: class Post(db.Model): __tablename__ = 'Posts' id = db.Column(db.Integer, primary_key=True) tags_relationship = db.relationship('Tag', secondary=tags, backref=db. backref('posts', lazy='dynamic')) tags =

[sqlalchemy] Re: Deleting from relationship

2015-02-22 Thread Asad Dhamani
I looked at my code some more, and found a now obvious mistake. I changed my code to: def edit(id, tags=None): edit_post = Post.query.get(id) if tags is not None and tags != : for tag in tags.split(','): tag = tag.strip( ) if tag not in edit_post.tags:

[sqlalchemy] Two different aggregates of the same field.

2015-02-22 Thread AndrewLvov
Let's say I have a an `Event`, `Facility`, `Producer`. How do I calculate aggregation result of a single field with different filters ? Here is an example: `class Facility: name = ... events = relashionship(... class Event: facility_id = ... producer = start_date = ...` The

[sqlalchemy] DetachedInstanceError

2015-02-22 Thread Ed Rahn
I am occassionally and randomly getting a DetachedInstanceError when I try to access an object atttribute that is a reference. I will run this several thousand times and only get it twice. What I don't understand is I use the same exact base query, which is where the reference takes place, and