def setvariable(cursor, mysqlvar, value):
 query = ('SET GLOBAL %s = ' % mysql_quote_identifier(mysqlvar, 'vars'))
 try:
  cursor.execute((query + '%s'), (value,))
  cursor.fetchall()
  result = True
 except Exception:
  e = get_exception()
  result = str(e)
 return result

def setvariable ( cursor , mysqlvar , value ) : query = ( 'SET GLOBAL %s = ' % mysql_quote_identifier ( mysqlvar , 'vars' ) ) try : cursor . execute ( ( query + '%s' ) , ( value , ) ) cursor . fetchall ( ) result = True except Exception : e = get_exception ( ) result = str ( e ) return result
set a global mysql variable to a given value the db driver will handle quoting of the given value based on its type .