[sqlalchemy] ORM and SQL expression package in same web app with use of threadlocal

2009-08-06 Thread n00b
greetings, i've been using mysql, SA ORM (scoped_session) with cherrypy and all is fine. however, i'm also using some MySQLdb-based connections and getting pretty tired of the 'mysql gone away' issues and lame db.ping () workarounds. hence, i want to move everything to SA using the

[sqlalchemy] mapping adjacency lists

2009-02-01 Thread n00b
g'day, i wanted to give the adjacency pattern a try in the context of a dog pedigree database and used http://groups.google.com/group/sqlalchemy/browse_thread/thread/d78357121da8014a/537377ff73bdede7?lnk=gstq=family+tree#537377ff73bdede7 as a reference. the requirement at hand is to be abe to

[sqlalchemy] Re: delete failure with foreign key relations

2009-01-29 Thread n00b
it automatically, you need to use sessions and mappers (not raw SQL expression engine), more info here: http://www.sqlalchemy.org/docs/05/ormtutorial.html#configuring-delete... Regards, Alex On Jan 29, 8:33 am, n00b pyn...@gmail.com wrote: back again, sorry. i specified a model with a few one

[sqlalchemy] Re: Getting ForeignKey Before Commit

2009-01-29 Thread n00b
why don't you work off the las/previous committed rec id? On Jan 29, 4:05 am, Dejan Mayo dejan.m...@gmail.com wrote: Hi, My code is like that: try:     for some_val in some_values:         rec = SomeModel()         rec.some_val = some_val         session.save(rec)     session.commit()

[sqlalchemy] delete failure with foreign key relations

2009-01-28 Thread n00b
back again, sorry. i specified a model with a few one-to-many and one many-to-many relations using SA 0.51 in MySql 5.1.25 rc; tables are all INNODB. all works well and as expected in the ORM realm. however, when i'm trying to use SQL Expression for a delete (row) operation, i get the dreaded

[sqlalchemy] session.merge()

2009-01-17 Thread n00b
greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form of a replacement of the existing object (record). (one of the columns, product_id, is unique=True). Hence, SA throws, as expected, an IntegrityError (1062,

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
thanks. i'll give it a shot. On Jan 17, 10:43 am, Michael Bayer mike...@zzzcomputing.com wrote: On Jan 17, 2009, at 4:07 AM, n00b wrote: greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form

[sqlalchemy] Re: session.merge()

2009-01-17 Thread n00b
, session.add(ob), and session.commit() will add the record into database Regards, Laurent n00b a écrit : greetings, i'm batch processing xml documents to mysql using SA 0.5, ORM. data extracted from xml docs may be new or an update in form of a replacement of the existing object

[sqlalchemy] session.add

2008-12-11 Thread n00b
hello, i need to generate a unique number from a table based on the primary key. i used to lock the table (with write) and got what i needed. working with the ORM, though, it seems that session.add(object) functions just as well. at the time of the session.add(), the primary key assigned to the

[sqlalchemy] Re: utf hex instead of utf-8 return

2008-12-07 Thread n00b
the   data should be considered as utf-8.   I'm not sure what version of   MySQL you're on or how older versions of that might get in the way. On Dec 6, 2008, at 1:26 PM, n00b wrote: thanks for the quick reply. i kept trying with it and no have reached the utter state of confusion

[sqlalchemy] Re: utf hex instead of utf-8 return

2008-12-06 Thread n00b
On Dec 5, 3:25 pm, Michael Bayer [EMAIL PROTECTED] wrote: I'm not sure of the mechanics of what you're experiencing, but make   sure you use charset=utf8use_unicode=0 with MySQL. On Dec 5, 2008, at 4:17 PM, n00b wrote: greetings, SA (0.5.0rc1) keeps returning utf hex in stead of utf-8

[sqlalchemy] utf hex instead of utf-8 return

2008-12-05 Thread n00b
greetings, SA (0.5.0rc1) keeps returning utf hex in stead of utf-8 and in the process driving me batty. all the mysql setup is fine, the chars look good and are umlauting to goethe's delight. moreover, insert and select are working perfectly with the MySQLdb api on three different *nix systems,