title: Insert TIMESTAMP with milliseconds in Oracle with cx_Oracle and Python 3.6
body: <p>I need to insert a timestamp with milliseconds in an Oracle table with Python 3.6 and cx_Oracle 6.4.1. The insert is done okay but I am losing the milliseconds on the way.</p>
  
  <p>The timestamp is passed as a datetime object. Any ideas how I could keep the milliseconds without making a to_timestamp() in the SQL itself? I would like to keep passing a datetime in the SQL transaction. I use executemany() as the idea is to insert multiple records at once.</p>
  
  <pre><code>import cx_Oracle
  import datetime
  
  conf = {
      'username': 'USERNAME',
      'password': 'PASSWORD',
      'tns': 'TNS'
  }
  
  d = datetime.datetime.now()
  print(d)
  
  db_conn = cx_Oracle.connect(conf['username'], conf['password'], conf['tns'], encoding='UTF-8', nencoding='UTF-8')
  cursor = db_conn.cursor()
  
  sql_insert = "INSERT INTO {} VALUES {}".format('timestamp_test', '(:1)')
  cursor.prepare(sql_insert)
  cursor.executemany(None, [[d]])
  db_conn.commit()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BXdr0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BXdr0.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/wBcKv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wBcKv.jpg" alt="enter image description here"></a></p>