On Thu, Dec 31, 2009 at 08:10, fboule <[email protected]> wrote: > I have the same problem with the snippet hereafter: > > from elixir import * > > class tt(Entity): > using_options(tablename = 'tt') > d = Field(Integer, primary_key = True) > > setup_all() > metadata.bind = 'mysql://localhost/test' > > while True: > a = tt.query.filter(None) > > for x in a: > print x.d > > raw_input('') > a = None > session.expire_all() > > Once inserted new records in the table tt by using the command-line > mysql client (and committed), pressing return to loop once shows the > very same set of records, without the newly inserted ones.
That's very strange, because your exact same code works fine here. I just ran it once with a create_all() after the bind (to create the table) then removed the line and it works perfectly here. I've tried with both SA 0.5.x and SA trunk, Elixir 0.6.0, Elixir 0.7.1 and trunk and could not reproduce your problem... I'm out of ideas... On mysql's side, I've simply done: mysql> insert into tt values(1); Query OK, 1 row affected (0.00 sec) I didn't commit explicitly as it is not needed on the command-line AFAIK (unless you create a transaction explicitly). FWIW, here are the versions I have installed: ii mysql-server-5.1 5.1.37-1ubuntu5 MySQL database server binaries ii python-mysqldb 1.2.2-10 A Python interface to MySQL > On the other hand, note that I found out that moving the metadata.bind > assignment into the while loop does the job. But that means to > reconnect to the engine over and over, which is quite ugly: Yeah, quite ugly indeed. Since this problem is most likely not related to Elixir, you might want to ask on SQLAlchemy's list. -- Gaëtan de Menten http://openhex.org -- You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en.
