3 - option
>>> id = 2 >>> >>> sqlContext.sql('select from firsttb where a = {}'.format(id)) DataFrame[a: int, b: string] >>> result = sqlContext.sql('select from firsttb where a = {}'.format(id)) >>> result.show() +---+-----+ | a| b| +---+-----+ |...