title: How to set Primary Key while creating a PySpark Dataframe
body: <p>I basically created a glue dynamic frame from the table I read "raw_tb". Then, I've converted the dynamic frame into Spark Dataframe using .todf() method. Now,  I'm trying to create 2 separate dataframes from raw_df.</p>
  
  <pre><code># Spark Context Object
  sc = SparkContext.getOrCreate()
  glueContext = GlueContext(sc)
  spark = glueContext.spark_session
  job = Job(glueContext)
  
  #sqlContext = SQLContext(sc)
  
  # Boto Client Objects
  client = boto3.client('glue', region_name=REGION_NAME)
  s3client = boto3.client('s3', region_name=REGION_NAME)
  
  RAW_TABLE = "raw_tb"
  </code></pre>
  
  <p>table_read_df=glueContext.create_dynamic_frame.from_catalog(RAW_DATABASE,RAW_TABLE) </p>
  
  <pre><code>raw_df = table_read_df.toDF()
  
  policy_tbl = raw_df['policynumber','status','startdate','expirationdate']
  location_tbl = raw_df['locationid','city','county','state','zip']
  </code></pre>
  
  <p>Here, I would like to set the "policynumber" column in policy_tbl and "locationid"  column in location_tbl as primary keys. I'm not sure how that's possible. Please help!</p>
  
  <p><a href="https://i.stack.imgur.com/OeI0N.png" rel="nofollow noreferrer">https://i.stack.imgur.com/OeI0N.png</a></p>