[Tutor] insert in postgresql

ajstec ajstec at bol.com.br
Wed Oct 1 13:02:46 EDT 2003


---------- Início da mensagem original -----------

      De: tutor-bounces at python.org
    Para: "ajstec" ajstec at bol.com.br
      Cc: "tutor" tutor at python.org
    Data: Wed, 01 Oct 2003 12:49:49 -0300
 Assunto: Re: [Tutor] insert in postgresql

> "ajstec" <ajstec at bol.com.br> writes:
> 
> > Hi all,
> >
> >     I am using pypgsql, and try :
> >
> >>>> a='cat'
> >>>> b='dog'
> >>>> db.query("insert into curso values
> > (default,"%(a)","%(b)")")
> > SyntaxError: invalid syntax
> >
> > Howto ?
> >
> > Ité (Bye) !
> 
> Olá Adilton. :-) Muito calor por aí?
> 
> 
> You statement is wrong 'cause you're mixing the quotes.
> 
> Try it like that:
> 
> db.query("insert into curso values (default, %s, %s)"
% (a, b))
> 
> If I got it correctly and 'default' is also a value
and not a variable
> name. 
> 
> 
> See you,
> -- 
> Godoy.     <godoy at metalab.unc.edu>
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor


Oi,  :-) só 31 graus

I tried diverse formats but ...

db.query("insert into curso values (default,%s,%s)"%(a,b))
Traceback (most recent call last):
  File "<pyshell#58>", line 1, in ?
    db.query("insert into curso values
(default,%s,%s)"%(a,b))
_pg.error: ERROR:  Attribute "cat" not found


Você é brasileiro ?

 
 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/





More information about the Tutor mailing list