title: Write AWS Glue DynamicFrame to redshift table
body: <p>I have a dynamic frame with following schema</p>
  <pre><code>root
  |-- source_id: long
  |-- scrape_timestamp_last: timestamp
  |-- scrap_timestamp_orig: timestamp
  |-- job_id_init: string
  |-- post_date: timestamp
  |-- date_posted: string
  |-- date_offset: int
  |-- target_id: long
  |-- job_id: long
  |-- status: string
  |-- hash_001: string
  |-- hash_002: string
  |-- update_flag: string
  </code></pre>
  <p>I want to write this dynamic frame to a redshift table. I have created the table in redshift database with similar column names as follows:</p>
  <pre><code>create table redshift_table_name
  (
      source_id bigint,
      target_id bigint,
      job_id_init varchar(50),
      job_id bigint,
      status varchar(50),
      scrap_timestamp_orig timestamp,
      date_posted varchar(100),
      date_offset int,
      post_date timestamp,
      scrap_timestamp_last timestamp,
      hash_001 varchar(200),
      hash_002 varchar(200),
      update_flag varchar(200)
  );
  </code></pre>
  <p>I am writing this frame to this redshift table as following code snippet:</p>
  <pre><code>dest_table = &quot;&lt;redshift_schema&gt;.&lt;redshift_table&gt;&quot;
  
  pre_actions = f&quot;DELETE FROM {dest_table} WHERE 1=1&quot;
  
  datasink = glueContext.write_dynamic_frame.from_jdbc_conf(
      frame=&lt;data_frame&gt;,
      catalog_connection=&quot;redshift_connection&quot;,
      connection_options={
          &quot;preactions&quot;: pre_actions,
          &quot;dbtable&quot;: dest_table,
          &quot;database&quot;: &quot;&lt;redshift_database&gt;&quot;,
      },
      redshift_tmp_dir=args[&quot;TempDir&quot;],
      transformation_ctx=&quot;datasink&quot;,
  )
  
  job.commit()
  </code></pre>
  <p>AWS Glue job shows the status as succeeded and there is no error in output log as well as error logs. But, when I query the table in redshift, it shows no record in the table. What could be the problem ?. I am new to Glue job and redshift and could not figure out the problem. Please help me.</p>