def METHOD_NAME(self, sql_context_variable_name):
    if sql_context_variable_name == "spark":
        command = 'sql("{}")'.format(self.query)
    else:
        command = 'sql({}, "{}")'.format(sql_context_variable_name, self.query)
    if self.samplemethod == "sample":
        command = "sample({}, FALSE, {})".format(command, self.samplefraction)
    if self.maxrows >= 0:
        command = "take({},{})".format(command, self.maxrows)
    else:
        command = "collect({})".format(command)
    command = "jsonlite:::toJSON({})".format(command)
    command = "for ({} in ({})) {{cat({})}}".format(
        constants.LONG_RANDOM_VARIABLE_NAME,
        command,
        constants.LONG_RANDOM_VARIABLE_NAME,
    )
    return Command(command)