I am running this inside a transaction...
def update_session(transaction):
global code
global sessionexists
count = transaction.execute_sql("update sessions set seentime=@t where sessioncode=@s", params={"s":code,"t":datetime.utcnow()},
param_types={"t": spanner.param_types.TIMESTAMP})
print("count "+str(count))
sessionexists = 0
for c in count:
print(c)
sessionexists = c
This does not seem to return number of rows updated...
Is there way to do it?
Solution:
Based on the valid answer...this seems to work as well
count = transaction.execute_update("update sessions set seentime=@t where sessioncode=@s", params={"s":code,"t":datetime.utcnow()},
param_types={"s": spanner.param_types.STRING,"t": spanner.param_types.TIMESTAMP})
count is the number of rows
.