title: Can't insert into Cassandra column family using Pycassa with composite row keys (UTF8Type, DateType)
body: <p>I've got a Cassandra column family (created using Pycassa) with the following schema:</p>
  
  <pre><code>ColumnFamily: tracker
    Key Validation Class: org.apache.cassandra.db.marshal.CompositeType(org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.DateType)
    Default column value validator: org.apache.cassandra.db.marshal.BytesType
    Cells sorted by: org.apache.cassandra.db.marshal.UTF8Type
    GC grace seconds: 864000
    Compaction min/max thresholds: 4/32
    Read repair chance: 0.1
    DC Local Read repair chance: 0.0
    Populate IO Cache on flush: false
    Replicate on write: true
    Caching: KEYS_ONLY
    Bloom Filter FP chance: default
    Built indexes: []
    Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
    Compression Options:
      sstable_compression: org.apache.cassandra.io.compress.SnappyCompressor
  </code></pre>
  
  <p>I'm trying to insert into it with the following line:</p>
  
  <pre><code>self.tracker_batcher.insert(tracker_key, dictionary_to_insert)
  </code></pre>
  
  <p>where <code>tracker_key</code> is:</p>
  
  <p><code>('cd7449e8-8f0d-4730-9ee4-ef60edfdd409', datetime.datetime(2013, 8, 14, 16, 47, 55, 856000))</code></p>
  
  <p>I'd expect this to work - I use datetypes in other tables as row keys and they work a treat. Additionally - it looks like I'm following the tutorial on the Pycassa site (<a href="http://pycassa.github.io/pycassa/assorted/composite_types.html" rel="nofollow">http://pycassa.github.io/pycassa/assorted/composite_types.html</a>).</p>
  
  <p>For further information I'm using Pycassa version 1.9.0 and Cassandra 1.2.8</p>
  
  <p>Thanks,</p>
  
  <p>Matt</p>
  
  <p>edit:</p>
  
  <p>In a bizarre twist of events, the first error message I receive:</p>
  
  <p><code>TypeError: A str or unicode value was expected, but datetime was received instead (2013-08-14 16:45:15.376000)</code></p>
  
  <p>I tried modifying the query as such:</p>
  
  <p><code>tracker_key = (str(dictionary_to_insert['session_id']), datetime.datetime.strftime(dictionary_to_insert['datestamp'], "%Y-%m-%d %H:%M:%S"))</code></p>
  
  <p>i.e. changed the datetime to a string</p>
  
  <p>and got the following error message:</p>
  
  <pre><code>    raise TypeError('DateType arguments must be a datetime or timestamp')
  TypeError: DateType arguments must be a datetime or timestamp
  </code></pre>
  
  <p>Baffling.</p>