Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Commonmark migration
Source Link

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1]this one but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

TypeError: not all arguments converted during string formatting

Thanks in advance! [1]: How can I use variables in an SQL statement in Python?

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

TypeError: not all arguments converted during string formatting

Thanks in advance! [1]: How can I use variables in an SQL statement in Python?

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially this one but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

TypeError: not all arguments converted during string formatting

Thanks in advance!

deleted 11 characters in body
Source Link

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

Error: [![enter image description here][2]][2]

TypeError: not all arguments converted during string formatting

Thanks in advance! [1]: How can I use variables in an SQL statement in Python? [2]: https://i.sstatic.net/HJW5w.png

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

Error: [![enter image description here][2]][2]

Thanks in advance! [1]: How can I use variables in an SQL statement in Python? [2]: https://i.sstatic.net/HJW5w.png

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

TypeError: not all arguments converted during string formatting

Thanks in advance! [1]: How can I use variables in an SQL statement in Python?

deleted 2 characters in body
Source Link

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially this one [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

`
def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

`Error: [![enter image description here][2]][2]

Thanks in advance! [1]: How can I use variables in an SQL statement in Python? [2]: https://i.sstatic.net/HJW5w.png

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially this one but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

`
def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

`

Thanks in advance!

I'm having this function that communicates via pymysql to an SQL database stored to my localhost. I know there are similar posts about formatting an SQL section especially [this one][1] but could anyone suggest a solution? Always getting TypeError: can't concat tuple to bytes. I suppose it's sth with the WHERE clause.

def likeMovement(pID):
 print("Give a rating for the movement with #id:%s" %pID)
 rate=input("Give from 0-5: ")
 userID=str(1)
 print(rate,type(rate))
 print(pID,type(pID))
 print(userID,type(userID))
 cursor=con.cursor()
 sqlquery='''UDPATE likesartmovement SET likesartmovement.rating=%s WHERE 
 likesartmovement.artisticID=? AND likesartmovement.userID=?''' % (rate,), 
 (pID,userID)
 cursor.execute(sqlquery)

Error: [![enter image description here][2]][2]

Thanks in advance! [1]: How can I use variables in an SQL statement in Python? [2]: https://i.sstatic.net/HJW5w.png

Source Link
Loading
default

AltStyle によって変換されたページ (->オリジナル) /