Re: [sqlalchemy] Session remove/close MySQL

2014-02-12 Thread Christian Démolis
Thx all NullPool solve my problem create_engine(cnx_str, poolclass=NullPool) 2014-02-07 19:11 GMT+01:00 Claudio Freire klaussfre...@gmail.com: On Fri, Feb 7, 2014 at 2:35 PM, Michael Bayer mike...@zzzcomputing.com wrote: The connection pool, if in use, will then not actually close the

[sqlalchemy] Session remove/close MySQL

2014-02-07 Thread Christian Démolis
Hi all, Actually, i have some problem closing my session... I tried using scopedsession with session.remove I tried using normal session with session.close But in both cases, the Mysql session stay open. Why closing session has no effet on current Mysql connections ? -- You received this

[sqlalchemy] twophase error sqlalchemy

2013-02-20 Thread Christian Démolis
Hi, AttributeError: 'NoneType' object has no attribute 'twophase' 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. Session already has a Connection associated for the given Connection's Engine) else: conn =

[sqlalchemy] Optimize and SqlAlchemy

2012-03-30 Thread Christian Démolis
Hi all, I have a very strange problem... I have an application which runs under SQL Alchemy. When my application is running and i launch OPTIMIZE TABLE in PhpMyAdmin, my process blocks showing this error Waiting for metadata lock When i close my application, the process unlocks. What happen in

Re: [sqlalchemy] Re: Association Proxy append a new item to relationship in same way as classic many to many relationship

2012-03-28 Thread Christian Démolis
the same behaviour that classic many to many relationship ? I already try adding : creator=lambda x: x to my association proxies* 2012/3/27 Michael Bayer mike...@zzzcomputing.com On Mar 27, 2012, at 4:35 AM, Christian Démolis wrote: Up! 2012/3/23 Christian Démolis christiandemo...@gmail.com

[sqlalchemy] Association Proxy append a new item to relationship in same way as classic many to many relationship

2012-03-23 Thread Christian Démolis
Hi all, class A(Base): __tablename__ = 'a' IdA = Column('IdA', Integer, primary_key=True) AllTheB = association_proxy(many_to_many_relation, relation_b) class ManyToManyRelation( __tablename__ = 'many_to_many_relation' IdA = Column(Integer, ForeignKey('A.IdA'),

Re: [sqlalchemy] Re: Handle many to many relationship

2012-03-19 Thread Christian Démolis
(articke) object and you save it ! PS: tarife ou tarif ? On Thursday, March 15, 2012 12:38:26 PM UTC+1, Christian Démolis wrote: Hi all, DossierTarife = Table('tarifer_dossier', Base.metadata, Column('IdDossier', Integer, ForeignKey('dossier.IdDossier'**)), Column('IdAt

Re: [sqlalchemy] Overload Query Object

2012-02-01 Thread Christian Démolis
Hi, right, it's that thanks 2012/1/31 Tate Kim insight...@gmail.com ** Hi, Have you checked the __iter__ method ? -- *From: * Christian Démolis christiandemo...@gmail.com *Sender: * sqlalchemy@googlegroups.com *Date: *Tue, 31 Jan 2012 17:39:54 +0100

[sqlalchemy] Overload Query Object

2012-01-31 Thread Christian Démolis
Hi Michael, i overload class Query in my script. i have 4 ways to obtain query's results. 1/ session.query(model.x).all() 2/ session.query(model.x).first() 3/ session.query(model.x).one() 4/ for e in session.query(model.x): print e in case 1,2,3, i know which method is used What method

[sqlalchemy] How to write and access attribute in many to many table

2011-03-14 Thread Christian Démolis
Hi all, I have a question about many to many Table containing attribute. How to access and write Max attribute in many to many table ? I already read that but i try to not use mapper and stay in declarative mode which is more user friendly :)

Re: [sqlalchemy] Attach a string to each results of a query

2010-12-10 Thread Christian Démolis
Okay it works literal() and literal_column() functions works with sqlite but only literal() function works with MySQLdb connector Thanks a lot !) 2010/12/9 Michael Bayer mike...@zzzcomputing.com On Dec 9, 2010, at 11:14 AM, Christian Démolis wrote: Could not locate column in row for column

[sqlalchemy] Attach a string to each results of a query

2010-12-09 Thread Christian Démolis
Hi, SELECT IdActe, coucou FROM `acte` WHERE 1 How to attach a string to each result of a query ? i try that but it doesn't work :( s = model.session.query(milieu, model.Dossier.NomEntreprise, model.Dossier.AgendaSensGroupement, model.Dossier.AgendaUnite, *Coucou*) Thx Chris -- You

[sqlalchemy] Strange behaviour with func.timediff?

2010-11-18 Thread Christian Démolis
Hi, I found a usecase that is illogical Here is the first code and his result in term. All is *False* milieu = model.aliased(model.Plage) s2 = model.session.query( milieu, model.func.timediff(milieu.Fin, milieu.Debut), *model.func.timediff(milieu.Fin,

Re: [sqlalchemy] Strange behaviour with func.timediff?

2010-11-18 Thread Christian Démolis
strings and Python constructs to cursor.execute(). On Nov 18, 2010, at 5:04 AM, Christian Démolis wrote: Hi, I found a usecase that is illogical Here is the first code and his result in term. All is *False* milieu = model.aliased(model.Plage) s2 = model.session.query

[sqlalchemy] TIMEDIFF and SQLAlchemy

2010-11-17 Thread Christian Démolis
Hi, Do you know how to do this query with sqlalchemy? *SELECT Id, TIMEDIFF( End, Start) FROM plage WHERE TIMEDIFF(End,Start)=TIME('02:20:00');* In my model, Start and End are DateTime Start = Column('Start', DateTime) End = Column('End', DateTime) -- You received this message because you are

Re: [sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)

2010-10-15 Thread Christian Démolis
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

[sqlalchemy] Very strange behaviour in SqlAlchemy (maybe a bug)

2010-10-12 Thread Christian Démolis
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(),

Re: [sqlalchemy] Sql Alchemy non Transactionnal

2010-09-21 Thread Christian Démolis
...@zzzcomputing.com On Sep 20, 2010, at 10:37 AM, Christian Démolis wrote: Hi, Can i use SqlAlchemy in a non transactionnal way ? How can i do it? Session() has an autocommit=True flag that will commit every flush() operation immediately and not retain an open transaction during usage. You may

Re: [sqlalchemy] Filter on relation???

2009-11-25 Thread Christian Démolis
Ok, i already use session.query, no problem with my code. It works very well at the moment. I m just curious about advanced functionnality of my favourite orm :) Thanks to you, i have discovered that we can : - define associationproxy - define a properties which returns the result of a

[sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
Is it possible to put a filter on a relation in the declaration? Example : LeNomDuUtilisateur = relation(Utilisateur, filter_by=Utilisateur.Login, backref=backref('verrouillage')) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
:18 +0100, Christian Démolis pisze: Is it possible to put a filter on a relation in the declaration? Example : LeNomDuUtilisateur = relation(Utilisateur, filter_by=Utilisateur.Login, backref=backref('verrouillage')) I'm not sure what exactly your example means.. but if you want extra

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
Cool, it's very powerful, it will allow me to save my Bandwidth because i take just what i want and not the entire object. Thanks Conor 2009/11/24 Conor conor.edward.da...@gmail.com Christian Démolis wrote: Thx for your answer Thomas I want the attribute to not return the complete object

Re: [sqlalchemy] Filter on relation???

2009-11-24 Thread Christian Démolis
i bind the relation to the light object It s a brutal method, i dont think if it can work... 2009/11/24 Conor conor.edward.da...@gmail.com Christian Démolis wrote: Cool, it's very powerful, it will allow me to save my Bandwidth because i take just what i want and not the entire object

[sqlalchemy] Re: problem with like

2009-10-14 Thread Christian Démolis
conor.edward.da...@gmail.com wrote: Christian Démolis wrote: Hi, The idea of creating another column is good but it will multiplicate the size of my table by 2 for nothing. Is it possible to use MYSQL regular expression search with sql alcmehy? If yes, what is the command? MySQL

[sqlalchemy] Re: problem with like

2009-10-12 Thread Christian Démolis
. Cheers, Andre On Fri, Oct 9, 2009 at 5:46 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I m stuck with a query about telephone number : I want to find in my database all the contact who have a telephone number. The difficulty is that some number

[sqlalchemy] Documentation please

2009-10-12 Thread Christian Démolis
Hello, class sqlalchemy.sql.expression.ColumnOperators¶ Defines comparison and math operations. __init__()¶ x.__init__(...) initializes x; see x.__class__.__doc__ for signature asc()¶ between(cleft, cright)¶ collate(collation)¶ concat(other)¶ contains(other,

[sqlalchemy] problem with like

2009-10-09 Thread Christian Démolis
Hi everybody, I m stuck with a query about telephone number : I want to find in my database all the contact who have a telephone number. The difficulty is that some number in the database can have space or . between numbers example : 06.06.50.44.11 or 45 87 12 45 65 This my query with like but

[sqlalchemy] Re: Orm slow to update why?

2009-10-02 Thread Christian Démolis
Update 1000 SqlAlchemy 31.0309998989 It s crazy ^^ I don t know why my station is slow? Do u have an idea?* 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just

[sqlalchemy] Re: Orm slow to update why?

2009-10-02 Thread Christian Démolis
SqlAlchemy 0.235000133514 Tunisia results Update 1000 MySQLdb 0.016324249 Update 1000 SqlAlchemy 31.0309998989 It s crazy ^^ I don t know why my station is slow? Do u have an idea?* 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: Maybe because the database

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
With ORM pure SQL 0.3123624 With MySQLdb without ORM 0.0940001010895 2009/9/30 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: Thx for your answer. MakeReleased is a method of com object windows agent (self.agent = DispatchWithEvents('CosmoAgent.clsCCAgent', Evenement

[sqlalchemy] Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Hi again, Is there any way to avoid checking database structure during the metadata.create_all declaration's phase? It can be good to check when we are in test phase but when we are in production and we are sure of our model, it can be good to bypass create_all checking to database.

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
\teloignement VARCHAR, \n\turl VARCHAR, \n\tPRIMARY KEY (`IdVil le`)\n)\n\n' () 2009/10/1 King Simon-NFHD78 simon.k...@motorola.com -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Christian Démolis Sent: 01 October 2009 10:40

[sqlalchemy] Re: Bypass checking to database structure (metadata.create_all)

2009-10-01 Thread Christian Démolis
Ok, i just realize that create_all is useless when database already exist. Starting my application is 6 seconds faster now. Thanks all 2009/10/1 limodou limo...@gmail.com On Thu, Oct 1, 2009 at 6:25 PM, Christian Démolis christiandemo...@gmail.com wrote: Thx Simon, I tried

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
sqlalchemy.engine.base.Engine.0x...7f50 [0, 1L] 2009-10-01 17:00:38,743 INFO sqlalchemy.engine.base.Engine.0x...7f50 COMMIT With ORM force update 0.45368665 2009/10/1 Michael Bayer mike...@zzzcomputing.com Michael Bayer wrote: Christian Démolis wrote: Hello, I tried all the method to compare

[sqlalchemy] Re: Orm slow to update why?

2009-10-01 Thread Christian Démolis
Maybe because the database is in Tunisia and my Computer in France. I don t use sqlite, i use MySQL. I just did a test on internet in Tunisia, 39kbits/sec upload and 417kbits/sec 2009/10/1 Michael Bayer mike...@zzzcomputing.com Christian Démolis wrote: With debug mode it seems to take 0.15

[sqlalchemy] Orm slow to update why?

2009-09-29 Thread Christian Démolis
i made a test i did that without sql alchemy orm: import MySQLdb import time # Establich a connection db = MySQLdb.connection(host=192.168.45.28, user=apm, passwd=apm, db=test_christian) # Run a MySQL query from Python and get the result set xref

[sqlalchemy] session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Hi everybody, I have a little problem with session.query. I try to optimize my queries with only attributes that i need. When we impose attribute, sqlalchemy return a rowtuple s = session.query(IdFile, NameFile) When we don't impose attribute, the return is the object s = session.query(File) Is

[sqlalchemy] Re: session.query object instead rowtuple

2009-09-28 Thread Christian Démolis
Ok thanks 2009/9/28 Mike Conley mconl...@gmail.com The column is available as e.Namefile, no need to subscript with numbers. On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis christiandemo...@gmail.com wrote: Hi everybody, I have a little problem with session.query. I try

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-18 Thread Christian Démolis
session.query behavior without change the code of sqlalchemy itself, please help me. 2009/9/17 Michael Bayer mike...@zzzcomputing.com Alexandre Conrad wrote: Christian, 2009/9/17 Christian Démolis christiandemo...@gmail.com: Bonjour, Tu es français je pense au vu de ton prénom. Je

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-18 Thread Christian Démolis
...@gmail.com In Python, you have to pass self as first argument to all methods of a class: class MyQuery(sqlalchemy.orm.query.Query): def __init__(self, *arg, **kw): ... Alex 2009/9/18 Christian Démolis christiandemo...@gmail.com: Hello, Thx for the answer, thx to Alexandre

[sqlalchemy] SQL ALCHEMY instantly refresh

2009-09-17 Thread Christian Démolis
How can i force sqlalchemy to refresh an object when i did a session.query??? Sqlalchemy seems to work with a cache, i want to deal with it. Nota : i use sqlalchemy in non transactional mode Session = scoped_session(sessionmaker(autocommit=True, bind=engine))

[sqlalchemy] Re: SQL ALCHEMY instantly refresh

2009-09-17 Thread Christian Démolis
query de sqlalchemy mais je n'ai pas réussi... J'ai trouvé ce lien qui est intéressant mais je n'ai pas réussi à l'exploiter : http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery 2009/9/17 Alexandre Conrad alexandre.con...@gmail.com 2009/9/17 Christian Démolis christiandemo