Jump to content
Sign in to follow this  
gregurs

Usar resultado da query anterior

Recommended Posts

gregurs

Boa tarde, estou a desenvolver um programa e quero utilizar o resultado do select para o insert. Mas dá-me erro TypeError: cannot concatenate 'str' and 'tuple' objects no insert. alguem me pode ajudar?

legis = c.execute("Select legis From legislatura Where "+regexData[1]+" BETWEEN 'data_inicio' and 'data_fim'")
               result = c.fetchall()
               #if (result[0][0] == legis):
               c.execute("INSERT INTO reunioes (data,r_legislatura) VALUES ('"+regexData[0]+"','"+result+"')")
               c.execute("INSERT INTO deputados (deputado, partido, presenca,reuniao) VALUES ('"+regexNome[i]+"','"+regexPartido[i]+"','"+regexAssiduidade[i]+"','"+regexData[0]+"')")
               conn.commit()
c.close

Edited by Rui Carlos
GeSHi

Share this post


Link to post
Share on other sites
icemonster2

Penso que seria util dizeres que tipo de informação contém as variáveis regexAssiduidade, regexData, e.t.c

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.