title: How to send the result of a sql statement to a for loop using pyspark?
body: <p>I am trying to send the sql result to a for loop. I am new to spark and python, please help.</p>
  
  <pre><code>    from pyspark import SparkContext
  sc =SparkContext()
  from pyspark.sql import HiveContext
  hive_context = HiveContext(sc)
  #bank = hive_context.table("cip_utilities.file_upload_temp")
  data=hive_context.sql("select * from cip_utilities.cdm_variable_dict")
  hive_context.sql("describe cip_utilities.cdm_variables_dict").registerTempTable("schema_def")
  temp_data=hive_context.sql("select * from schema_def")
  temp_data.show()
  data1=hive_context.sql("select col_name from schema_def where data_type&lt;&gt;'string'")
  data1.show()
  </code></pre>