title: spark-redshift unload data. Directory name and save in CSV
body: <p>I got problem with spark-redshift lib from databricks. Actually I have 2 questions.</p>
  
  <ol>
  <li>How I can UNLOAD data in .csv format with headers?</li>
  <li>How I can set CUSTOM directory name ? By that I mean ignore those random numbers</li>
  </ol>
  
  <blockquote>
    <p>INFO RedshiftRelation: UNLOAD ('SELECT "companynumber", "companyname" FROM (select companynumber,companyname from cf_core.company) ') TO 's3://xxx/Spark/6b70cb07-9499-4442-8e3a-335f2cb2c8ae/' WITH CREDENTIALS 'aws_iam_role=arn:aws:iam::xxxxx:role/somerole' ESCAPE MANIFEST</p>
  </blockquote>
  
  <pre><code>    val companiesData = spark.read.format("com.databricks.spark.redshift")
      .option("url","jdbc:redshift://xxxx:5439/cf?user="+user+"&amp;password="+password)
      .option("query","select companynumber,companyname from cf_core.company")
      //.option("dbtable",schema+"."+table)
      .option("aws_iam_role","arn:aws:iam::xxxxxx:role/somerole")
      .option("tempdir","s3a://xxxxx/Spark")
      .load()
  </code></pre>
  
  <p>Thank you for help and answers ! </p>