title: Use cassandra inbuild `now()` function to generate TimeUUID with Model in Python driver
body: <p>I have code as </p>
  
  <pre><code>import time
  
  from uuid import uuid4
  
  import cassandra
  from cassandra.cqlengine.models import Model
  from cassandra.cqlengine.query import BatchQuery
  from cassandra.cqlengine import columns, connection
  from cassandra.cqlengine.management import sync_table
  
  
  class StudentModel(Model):
      __table_name__ = 'student'
      id = columns.UUID(primary_key=True, default=uuid4)
      created_timestamp = columns.TimeUUID(primary_key=True,
                                           clustering_order='DESC',
                                           default=cassandra.util.uuid_from_time(time.time()))
      name = columns.Text(required=True, default='')
  
  class ClassRoomModel(Model):
      __table_name__ = 'class_room'
      id = columns.UUID(primary_key=True, default=uuid4)
      created_timestamp = columns.TimeUUID(primary_key=True,
                                           clustering_order='DESC',
                                           default=cassandra.util.uuid_from_time(time.time()))
      name = columns.Text(required=True, default='')
  
  class StudentToClass(Model):
      __table_name__ = 'student_to_class_mapping'
      class_room_id = columns.UUID(primary_key=True)
      created_timestamp = \
          columns.TimeUUID(primary_key=True,
                           clustering_order='DESC',
                           default=cassandra.util.uuid_from_time(time.time()))
      student_id = columns.UUID()
  
  class ClassToStudent(Model):
      __table_name__ = 'class_to_student_mapping'
      student_id = columns.UUID(primary_key=True)
      created_timestamp = \
          columns.TimeUUID(primary_key=True,
                           clustering_order='DESC',
                           default=cassandra.util.uuid_from_time(time.time()))
      class_room_id = columns.UUID()
  
  if __name__ == '__main__':
      connection.setup(hosts=['localhost'],
                       default_keyspace='test')
      sync_table(StudentModel)
      sync_table(ClassRoomModel)
      sync_table(StudentToClass)
      sync_table(ClassToStudent)
  
      students = []
      for i in xrange(100):
          students.append(StudentModel.create(name='student' + str(i)))
  
      class_room = ClassRoomModel.create(name='class1')
  
      for student in students:
          print "Creating batch for: ", student.name
          with BatchQuery() as batch_query:
              ClassToStudent.batch(batch_query).create(
                  student_id=student.id, class_room_id=class_room.id)
              StudentToClass.batch(batch_query).create(
                  student_id=student.id, class_room_id=class_room.id)
  </code></pre>
  
  <p>This code works fine, and it created records too. When I check the records count, it match for 3 tables, but for <code>test.student_to_class_mapping</code>, it has to be 100, but it gives only <code>1</code>.</p>
  
  <pre><code>cqlsh&gt; select count(*) from test.student;
  
   count
  -------
     100
  
  (1 rows)
  cqlsh&gt; select count(*) from test.class_room ;
  
   count
  -------
       1
  
  (1 rows)
  cqlsh&gt; select count(*) from test.class_to_student_mapping;
  
   count
  -------
     100
  
  (1 rows)
  cqlsh&gt; select count(*) from test.student_to_class_mapping ;
  
   count
  -------
       1
  
  (1 rows)
  </code></pre>
  
  <p>I found the issue, logic wise its correct, only issue is <code>clusturing_key</code> in <code>test.student_to_class_mapping</code>.</p>
  
  <pre><code>created_timestamp = \
      columns.TimeUUID(primary_key=True,
                       clustering_order='DESC',
                       default=cassandra.util.uuid_from_time(time.time()))
  </code></pre>
  
  <p><code>cassandra.util.uuid_from_time(time.time())</code> is not able to generate <code>Unique</code> uuid for each record. I can use <code>uuid1</code> but I already face issue with <a href="https://stackoverflow.com/questions/43807341/cassandra-timeuuid-flood-file-descriptor-when-use-uuid-in-default"><code>uuid1</code></a>.</p>
  
  <p>I know, we can use <a href="http://docs.datastax.com/en/cql/3.3/cql/cql_reference/timeuuid_functions_r.html" rel="nofollow noreferrer"><code>now()</code></a>, I change my code to</p>
  
  <pre><code>from cassandra.query import BatchStatement, SimpleStatement
  from cassandra.cqlengine import connection
  ...
  ...
      batch_query = BatchStatement()
      batch_query.add(
          SimpleStatement('INSERT INTO {0} '
              '("student_id", "created_timestamp", "class_room_id") '
              'VALUES ({1}, now(), {2})'.format(
                  StudentToClass.column_family_name(),
                  student.id, class_room.id)))
      batch_query.add(
          SimpleStatement('INSERT INTO {0} '
              '("student_id", "created_timestamp", "class_room_id") '
              'VALUES ({1}, now(), {2})'.format(
                  ClassToStudent.column_family_name(),
                  student.id, class_room.id)))   
      connection.session.execute(batch_query) 
  ...
  ... 
  </code></pre>
  
  <p>Now its working fine and creating all records as per logic.</p>
  
  <p>I want to know that, is there any way to use <code>now()</code> with Model's <code>create</code> method?</p>