Re: [sqlalchemy] Re: Deleting from relationship

2015-02-23 Thread Simon King
I haven't looked at your code in detail, so this may not be the cause of the problem, but in general it is a bad idea to modify a collection while you are iterating over it. ie. this is not generally safe: for tag in edit_post.tags: edit_post.tags.remove(tag) Removing the tag from the tags

Re: [sqlalchemy] Re: Deleting from relationship

2015-02-23 Thread Asad Dhamani
Hi Simon, I followed your advice, and changed my code to this: 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: add_tags =

Re: [sqlalchemy] How do we define a relationship in sqlalchemy for a innodb file without actually creating the FK

2015-02-23 Thread Simon King
On Mon, Feb 23, 2015 at 12:02 PM, eli rashlin eli.rash...@gmail.com wrote: I have a table which i have changed the Engine from Myisam to InnoDB, This is the only table that has been changed, there are other tables that are in relation with this table of 1:N class Signals(Base, sql_functions):

[sqlalchemy] How do we define a relationship in sqlalchemy for a innodb file without actually creating the FK

2015-02-23 Thread eli rashlin
I have a table which i have changed the Engine from Myisam to InnoDB, This is the only table that has been changed, there are other tables that are in relation with this table of 1:N class Signals(Base, sql_functions): __tablename__ = 'Signals' def __init__(self, message_id=None,

Re: [sqlalchemy] How can I know which fields cause IntegrityError when inserting into a table with multiple unique fields?

2015-02-23 Thread Maurice Schleußinger
Thanks for the reply! Since I create objects concurrently I can not predict and therefore not pre-select all rows which could possibly provoke IntegrityErrors. On the other hand Session.merge() seams to provide the functionality which could resolve my problem. In my setup many processes

[sqlalchemy] Re: DetachedInstanceError

2015-02-23 Thread Jonathan Vanasco
On Sunday, February 22, 2015 at 10:09:18 PM UTC-5, Ed Rahn wrote: Let mw know if you need anything else! What version of SqlAlchemy are you using? That may affect someone's answer. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: [sqlalchemy] Re: DetachedInstanceError

2015-02-23 Thread Ed Rahn
On Mon, 23 Feb 2015 07:19:34 -0800 (PST) Jonathan Vanasco jonat...@findmeon.com wrote: On Sunday, February 22, 2015 at 10:09:18 PM UTC-5, Ed Rahn wrote: Let mw know if you need anything else! What version of SqlAlchemy are you using? That may affect someone's answer. I was running

Re: [sqlalchemy] DetachedInstanceError

2015-02-23 Thread Michael Bayer
On Feb 22, 2015, at 10:09 PM, Ed Rahn edsr...@gmail.com wrote: 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

Re: [sqlalchemy] How can I know which fields cause IntegrityError when inserting into a table with multiple unique fields?

2015-02-23 Thread Michael Bayer
On Feb 23, 2015, at 8:49 AM, Maurice Schleußinger m.schleusin...@gmail.com wrote: Thanks for the reply! Since I create objects concurrently I can not predict and therefore not pre-select all rows which could possibly provoke IntegrityErrors. On the other hand Session.merge()