PythonのMySql DBを使用してテーブルの値を更新しようとしていますが、このエラーが発生しています。 TypeError: query() argument 1 must be a string or read-only buffer, not tuple
。 そして私は私の答えが間違っているのは間違っています。TypeError:query()引数1は、タプルではなく、文字列または読み取り専用バッファでなければなりません。
def id_of_unverifedUniversity():
cur3.execute('select id from universities where verified=0 and deleted=0;')
print "===================Unverififed University================"
for row in cur3.fetchall():
#cur3.execute('SELECT id FROM Users where universityId='+str(row['id']))
print row['id']
query = ('SELECT id FROM users where universityId = %s order by id asc limit 1' %(str(row['id'])))
cur3.execute(query)
result = cur3.fetchall()
for y in result:
if y['id']:
print str(y['id'])
print 'update query statred'
query1 = ("""update universities set updatedBy = %s where id=%s""", (str(y['id']),str(row['id'])))
cur3.execute(query1)
私はquery1
でQuery1を
、クエリが正常に動作している –
@Abi Waqasが更新でそれを参照してください、 '%'演算子はquery1' 'で逃しているようです回答 – Rajez