title: Read Headers from Data Source in an AWS Glue Job
body: <p>I have an AWS Glue job that reads from a data source like so:</p>
  
  <pre class="lang-py prettyprint-override"><code>datasource0 = glueContext.create_dynamic_frame.from_catalog(database = "dev-data", table_name = "contacts", transformation_ctx = "datasource0")
  </code></pre>
  
  <p>But when I call .toDF() on the dynamic frame, the headers are 'col0', 'col1', 'col2' etc. and my actual headers are in the first row of the dataframe.</p>
  
  <p>Note - I can't set them manually as the columns in the data source are variable &amp; iterating over the columns in a loop to set them results in error because you'd have to set the same dataframe variable multiple times, which glue can't handle.</p>
  
  <p>How might I capture the headers while reading from the data source?</p>