Re: [sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)
Thanks 2010/10/14 Michael Bayer mike...@zzzcomputing.com On Oct 13, 2010, at 10:48 AM, Christian Démolis wrote: Hi, q = model.session.query( # model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.Fonction ) q = q.limit(5) print str(q) for e in q.all() : print Fonction, e.Fonction This is the result (result1.jpg) q = model.session.query( model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.Fonction ) q = q.limit(5) print str(q) for e in q.all() : print Fonction, e.Fonction The SQL is correct. The any() has no label and is throwing off the label names - this is a bug and is fixed in rd67812029db9, downloadable at http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz . Otherwise, apply any(...).label('some label') so that e.Fonction targets the column you want. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.comsqlalchemy%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)
On Oct 13, 2010, at 10:48 AM, Christian Démolis wrote: Hi, q = model.session.query( # model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.Fonction ) q = q.limit(5) print str(q) for e in q.all() : print Fonction, e.Fonction This is the result (result1.jpg) q = model.session.query( model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.Fonction ) q = q.limit(5) print str(q) for e in q.all() : print Fonction, e.Fonction The SQL is correct. The any() has no label and is throwing off the label names - this is a bug and is fixed in rd67812029db9, downloadable at http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz . Otherwise, apply any(...).label('some label') so that e.Fonction targets the column you want. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
[sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)
Hello, I actually try to migrate to SqlAlchemy 0.6.4 (before i was in 0.5.2) One of my query seems to not work properly in this new version It seems to be a bug in Sql Alchemy because of this part of my query *model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None))* All the field which are after this part seems to be corrupted the n+1 field seems to return the result of the n field n+2 field return the result of n+1 field... s = model.session.query(model.Collaborateur.IdCollaborateur, model.Collaborateur.Nom, model.Collaborateur.Prenom, model.Collaborateur.Type, model.Collaborateur.Civilite, model.Collaborateur.Titre, model.Collaborateur.Inactif, model.Collaborateur.MotCle, model.Collaborateur.IdProfilIca , model.Collaborateur.Responsable, model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.TypeEnvoi, model.Collaborateur.Fonction ) s = s.filter(model.Collaborateur.IdDossier==983) # On commence par extraire de la bdd les collaborateurs qui font partie du dossier for e in s: print Fonction, e.Fonction, TypeEnvoi, e.TypeEnvoi All works better when i put the green part at the end of the query (after the red part) but i wonder why it works before in 0.5.2 and not in 0.6.4??? Thx Chris -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
Re: [sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)
On Oct 12, 2010, at 7:58 AM, Christian Démolis wrote: Hello, I actually try to migrate to SqlAlchemy 0.6.4 (before i was in 0.5.2) One of my query seems to not work properly in this new version It seems to be a bug in Sql Alchemy because of this part of my query model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)) All the field which are after this part seems to be corrupted the n+1 field seems to return the result of the n field n+2 field return the result of n+1 field... s = model.session.query(model.Collaborateur.IdCollaborateur, model.Collaborateur.Nom, model.Collaborateur.Prenom, model.Collaborateur.Type, model.Collaborateur.Civilite, model.Collaborateur.Titre, model.Collaborateur.Inactif, model.Collaborateur.MotCle, model.Collaborateur.IdProfilIca , model.Collaborateur.Responsable, model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(), model.Instruction.FinValidite==None)), model.Collaborateur.TypeEnvoi, model.Collaborateur.Fonction ) s = s.filter(model.Collaborateur.IdDossier==983) # On commence par extraire de la bdd les collaborateurs qui font partie du dossier for e in s: print Fonction, e.Fonction, TypeEnvoi, e.TypeEnvoi All works better when i put the green part at the end of the query (after the red part) but i wonder why it works before in 0.5.2 and not in 0.6.4??? cant do much here without an illustration of the SQL that's generated, and most helpfully some runnable code that reproduces the issue. If the SQL itself is misformed, creating the offending query and calling str(q) is sufficient to demonstrate. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.