Re: [sqlalchemy] select rows ordered by dependency

2015-06-10 Thread Ofir Herzas
Thanks Michael, I need a cross-dialect solution so if that's the best we have, I think I'll go with the inefficient load-everything-and-sort-in-python method :) On Tuesday, June 9, 2015 at 9:32:03 PM UTC+3, Michael Bayer wrote: you'd need to look into recursive querying. PG can do this with

[sqlalchemy] Re: Session is commiting without an add()

2015-06-10 Thread Gilcan Machado
I've discovered if I use an object (found by session.query) as the value for the relationship field, I get the issue of having objects being added without explicit add() method. But if I insert, for the relationship, the id of the register in database (of the object got by session.query), I

[sqlalchemy] Session is commiting without an add()

2015-06-10 Thread Gilcan Machado
Hi. I'm dealing with a weid situation: My 'session' is loaded with objects, and when I commit all the objects are saved in the database, but without any execution of add() method. How is this possible. It's a problem to me because I'm creating a lot of objects and return it as a list to

[sqlalchemy] Re: Session is commiting without an add()

2015-06-10 Thread Jonathan Vanasco
You're experiencing exactly what Michael pointed you to. Person has a relationship+backref to SourceDatabase though `Person.source_database`. When you create a `John` and assign the existing source_database, sqlalchemy is implicitly adding the Person so that the update you explicitly

Re: [sqlalchemy] Session is commiting without an add()

2015-06-10 Thread Gilcan Machado
Ok. Here's a code as an example of my situation: First, the file ormdb.py: db = create_engine('mysql+mysqlconnector://root:password@localhost/debug',paramstyle='format') db.echo = False Base = declarative_base() source_databases = Table('source_databases', MetaData(bind=None)) person

Re: [sqlalchemy] Session is commiting without an add()

2015-06-10 Thread Gilcan Machado
I'll try to isolate the code and put here. Em quarta-feira, 10 de junho de 2015 16:02:45 UTC-3, Gilcan Machado escreveu: Is worse than that. I simply don't use the add() method in any line. There's no add() method being executed. But a commit() saves all the objects in the database.

Re: [sqlalchemy] Session is commiting without an add()

2015-06-10 Thread Mike Bayer
On 6/10/15 2:22 PM, Gilcan Machado wrote: Hi. I'm dealing with a weid situation: My 'session' is loaded with objects, and when I commit all the objects are saved in the database, but without any execution of add() method. How is this possible. It's a problem to me because I'm creating a

Re: [sqlalchemy] Session is commiting without an add()

2015-06-10 Thread Gilcan Machado
Is worse than that. I simply don't use the add() method in any line. There's no add() method being executed. But a commit() saves all the objects in the database. Seems that sqlalchemy is executing add() method in background... []s Gil Em quarta-feira, 10 de junho de 2015 15:44:06 UTC-3,

[sqlalchemy] .any() queries and MySQL performance

2015-06-10 Thread Eric Ogren
Hello, I have a very simple data model with a one to many relationship - a thread could have many identifiers that link to it: class Thread(Base): __tablename__ = 'threads' id = Column(Integer, primary_key=True) link = Column(String(length=512, collation=UTF8),

Re: [sqlalchemy] .any() queries and MySQL performance

2015-06-10 Thread Mike Bayer
On 6/10/15 10:32 PM, Eric Ogren wrote: Hello, I have a very simple data model with a one to many relationship - a thread could have many identifiers that link to it: class Thread(Base): __tablename__ = 'threads' id = Column(Integer, primary_key=True) link =