On Mon, 4 Sep 2006 16:07:51 +0200
"Andrija Zaric" <[EMAIL PROTECTED]> wrote:

> If you are going to do script once and outside main application, maybe
> this is going to be little faster:
> 
> users = session.query(Users).select()
> 
> ref_pairs = []
> for u in users:
>     ref_pairs.extend([(u.id, int(pr_id)) for pr_id in
> u.fk_project.split(',')])
> 
> #this should do multi-value insert:
> users_projects.insert().execute(*ref_pairs)

Sounds good, the only problem is that the fk_project is a field like
1,15,40, and so when I split it I obtain:
['1','15','40','']

So your this method raise an exception ValueError.

-- 
-------------------------------------------------------------------
       (o_
(o_    //\  Coltivate Linux che tanto Windows si pianta da solo.
(/)_   V_/_
+------------------------------------------------------------------+
|     ENRICO MORELLI         |  email: [EMAIL PROTECTED]       |
| *     *       *       *    |  phone: +39 055 4574269             |
|  University of Florence    |  fax  : +39 055 4574253             |
|  CERM - via Sacconi, 6 -  50019 Sesto Fiorentino (FI) - ITALY    |
+------------------------------------------------------------------+

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to