<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">Je test ma messagerie en changeant de navigateur&nbsp;(envoie de mes réponses sous forme de pièce jointe URL)</FONT></DIV> <DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif"></FONT>&nbsp;</DIV> <DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">J'en profite pour une poser une question :</FONT></DIV> <DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif"></FONT>&nbsp;</DIV> <DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">Le module psycopg2 est très utile. Cependant :</FONT></DIV> <DIV><BR></DIV> <DL class=codebox> <DT><CODE><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">param=str("'" + self.dlg.ui.liste_table.currentText() + "'")<BR>requete="select column_name from information_schema.columns where table_schema || '.' || table_name=('%s');"<BR>conn = psycopg2.connect(host="xxx", port="xx", database="xxx", user="xxxx", password="xxx")<BR>cur_champs=conn.cursor()<BR>cur_champs.execute(requete, param)</FONT></CODE></DT> <DT><CODE></CODE><BR><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">param&nbsp;= 'schema.table'</FONT></DT></DL> <DIV>Cette requète fonctionne cependant j'obtiens un message d'erreur avec python :<BR></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">cur_champs.execute(requete, param)<BR>TypeError: not all arguments converted during string formatting</FONT></DIV> <DL class=codebox> <DT><BR>Merci</DT></DL> <DIV>&nbsp;</DIV> <DIV><BR><BR>&nbsp;</DIV><BR><BR><FONT color=#990099>-----francophone-bounces@lists.osgeo.org a écrit : -----</FONT>  <DIV> <BLOCKQUOTE style="BORDER-LEFT: black 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">A : francophone@lists.osgeo.org<BR>De : francophone-request@lists.osgeo.org<BR>Envoyé par : francophone-bounces@lists.osgeo.org<BR>Date : 13/01/2012 18:01<BR>Objet : Francophone Digest, Vol 60, Issue 4<BR><BR><FONT face="Default Monospace,Courier New,Courier,monospace">Send Francophone mailing list submissions to<BR>francophone@lists.osgeo.org<BR><BR>To subscribe or unsubscribe via the World Wide Web, visit<BR><A href="http://lists.osgeo.org/mailman/listinfo/francophone">http://lists.osgeo.org/mailman/listinfo/francophone</A><BR>or, via email, send a message with subject or body 'help' to<BR>francophone-request@lists.osgeo.org<BR><BR>You can reach the person managing the list at<BR>francophone-owner@lists.osgeo.org<BR><BR>When replying, please edit your Subject line so it is more specific<BR>than "Re: Contents of Francophone digest..."<BR><BR><BR>Today's Topics:<BR><BR>&nbsp;&nbsp; 1. requete sql dans script python (j.allain@agglo-paysflers.fr)<BR>&nbsp;&nbsp; 2. Re: requete sql dans script python (Yves Jacolin)<BR><BR><BR>----------------------------------------------------------------------<BR><BR>Message: 1<BR>Date: Fri, 13 Jan 2012 12:24:00 +0100<BR>From: j.allain@agglo-paysflers.fr<BR>Subject: [Francophone] requete sql dans script python<BR>To: francophone@lists.osgeo.org<BR>Message-ID:<BR>&lt;OF1DA25C85.3F5B0E74-ONC1257984.003E9F90-C1257984.003E9F91@agglo-paysflers.fr&gt;<BR><BR>Content-Type: text/plain; charset="us-ascii"<BR><BR>An HTML attachment was scrubbed...<BR>URL: <A href="http://lists.osgeo.org/pipermail/francophone/attachments/20120113/b8574c74/attachment-0001.html">http://lists.osgeo.org/pipermail/francophone/attachments/20120113/b8574c74/attachment-0001.html</A><BR><BR>------------------------------<BR><BR>Message: 2<BR>Date: Fri, 13 Jan 2012 13:20:46 +0100<BR>From: Yves Jacolin &lt;yjacolin@free.fr&gt;<BR>Subject: Re: [Francophone] requete sql dans script python<BR>To: francophone@lists.osgeo.org<BR>Message-ID: &lt;201201131320.52945.yjacolin@free.fr&gt;<BR>Content-Type: Text/Plain; &nbsp;charset="iso-8859-15"<BR><BR>Le vendredi 13 janvier 2012 12:24:00, j.allain@agglo-paysflers.fr a écrit :<BR>&gt; &nbsp;Bonjour,<BR>&gt; <BR>&gt; Je souhaite exécuter une requête sql dans un script python. J'ai essayé<BR>&gt; avec "setDataSource" mais je ne suis pas sur que cela puisse me retourner<BR>&gt; des résultats exploitables.<BR>&gt; <BR>&gt; Merci d'avance pour vos conseils.<BR>Bonjour,<BR><BR>Si tu utilises une base Postgresql : <BR><A href="http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries">http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries</A><BR><BR>Y.<BR>-- <BR>Yves Jacolin<BR><BR><A href="http://yjacolin.gloobe.org/">http://yjacolin.gloobe.org</A><BR><BR><BR>------------------------------<BR><BR>_______________________________________________<BR>Francophone mailing list<BR>Francophone@lists.osgeo.org<BR><A href="http://lists.osgeo.org/mailman/listinfo/francophone">http://lists.osgeo.org/mailman/listinfo/francophone</A><BR><BR><BR>End of Francophone Digest, Vol 60, Issue 4<BR>******************************************<BR></FONT></BLOCKQUOTE></DIV> <DIV></DIV></font>