[sqlalchemy] Re: broken relationship

2008-01-07 Thread Alexandre da Silva


I am not sure, but, I think after you save feed, in this case you don't
need to call session.flush() maybe it is clearing the sessionand the
feed object too. try to remove it or test if is none after
session.flush()
 session.save (feed)
 session.flush ()
 
 post= Post (
-- 
Alexandre da Silva
Analista de Sistemas - Bacharel em Sistemas de Informação (2003-2007)

gedit-todo
http://alexandredasilva.wordpress.com/gedit-todo-list-plugin/
MicroDB
http://www.assembla.com/space/microdb
Open Sales Force System
http://www.assembla.com/space/osfs
opencomanche ([stopped] mail-me to get the latest source code)
http://sourceforge.net/projects/opencomanche/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: broken relationship

2008-01-07 Thread Marcos Dione

On Mon, Jan 07, 2008 at 01:00:20AM -0200, Marcos Dione wrote:
 until yesterday did worked, but seems like after I upgraded to the
 new sqla 0.4.2-1 from Debian Sid, it broke this way. am I doing anything
 conceptually wrong?
 
 --
 $ sqlite3 test.sqlt
 SQLite version 3.4.2
 Enter .help for instructions
 sqlite select * from post;
 1|http://bonga.org/posts/post.html||Fist post!|This the fist post. Like the 
 fist import, but not.|2008-01-07 00:44:03|read
   ^^ this is where feed_id should not be NULL!
 sqlite select * from feed;
 1|bonga|http://bonga.org/rss.xml|1
 -- 

more info. this is with meta.echo= True:

2008-01-07 01:09:32,430 INFO sqlalchemy.engine.base.Engine.0x..14 BEGIN
2008-01-07 01:09:32,433 INFO sqlalchemy.engine.base.Engine.0x..14 INSERT INTO 
feed (name, url, active) VALUES (?, ?, ?)
2008-01-07 01:09:32,435 INFO sqlalchemy.engine.base.Engine.0x..14 ['bonga', 
'http://bonga.org/rss.xml', 1]
2008-01-07 01:09:32,438 INFO sqlalchemy.engine.base.Engine.0x..14 COMMIT
2008-01-07 01:09:32,486 INFO sqlalchemy.engine.base.Engine.0x..14 BEGIN
2008-01-07 01:09:32,494 INFO sqlalchemy.engine.base.Engine.0x..14 INSERT INTO 
post (guid, feed_id, title, content, date, state) VALUES (?, ?, ?, ?, ?, ?)
2008-01-07 01:09:32,495 INFO sqlalchemy.engine.base.Engine.0x..14 
['http://bonga.org/posts/post.html', None, 'Fist post!', 'This the fist post. 
Like the fist import, but not.', '2008-01-07 01:09:32', 'read']
2008-01-07 01:09:32,506 INFO sqlalchemy.engine.base.Engine.0x..14 COMMIT

evidently sqla is not working for me as before.

 class SQLAObject (object):
 def __init__ (self, **kwargs):
 object.__init__ (self)
 self.__dict__.update (kwargs)

I got this in IRC:

01:33  zzzeek_ styxman: updating __dict__ directly is a no no
01:33  zzzeek_ have to use setattr()

maybe is that? I'll check later.

-- 
(Not so) Random fortune:
10:22  el_machi e-squizo: es que ayer nos pasó lo impensable: estábamos por
sopletear una pc para quitarle la tierra, en lo de un amigo, y en un 
descuido el perro nos meó la computadora...

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: broken relationship

2008-01-07 Thread Marcos Dione

On Mon, Jan 07, 2008 at 03:41:22PM -0200, Marcos Dione wrote:
 On Mon, Jan 07, 2008 at 01:00:20AM -0200, Marcos Dione wrote:
  class SQLAObject (object):
  def __init__ (self, **kwargs):
  object.__init__ (self)
  self.__dict__.update (kwargs)
 
 I got this in IRC:
 
 01:33  zzzeek_ styxman: updating __dict__ directly is a no no
 01:33  zzzeek_ have to use setattr()
 
 maybe is that? I'll check later.

yes, it was. I changed the code to this and it started working
again:

class SQLAObject (object):
def __init__ (self, **kwargs):
object.__init__ (self)
for (k, v) in kwargs.items ():
setattr (self, k, v)

-- 
(Not so) Random fortune:
23:19  perrito666 yogurt2ungue: justo estoy viendo una pelicula que
demuestra en que se ha convertido #grulic
23:19  perrito666 alguna vez viste equilibrium?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---