 
 (defn fmt-del-tattr [data]
   (if (contains? data :time)
-    (let [[bucket hitime lotime] (decode-time (:time data))]
+    (let [[bucket slot] (decode-time (:time data))]
       [(delete-query
         :t_attr
-        (columns {:data lotime})
         (where :key (:key data)
                :name (:name data)
                :bucket bucket
-               :hitime hitime))])
+               :slot slot))])
     (fmt-del-index :t_index {:key (:key data)
                              :name (:name data)})))
 

    (create-table
     cluster :t_attr
     (if-not-exists)
     (column-definitions {:key :uuid :name :varchar :bucket :bigint :hitime :int :data (map-type :int :blob) :primary-key [[:key :name :bucket] :hitime]})
     (with {:compaction {:class "LeveledCompactionStrategy" :sstable_size_in_mb "128"}})))
  (when-not (describe-table cluster keyspace :k_attr)
    (warn "creating table k_attr")

(defn decode-time [time-in-sec]
  (let [time (from-long (* 1000 time-in-sec))
        bucket (quot (to-long (date-time (year time) (month time) (day time))) 1000)
        slot (- time-in-sec bucket)]
    [bucket slot]))

(defn encode-time [bucket slot]
  (+ bucket slot))

(defn check-schema [cluster keyspace]
  (when-not (describe-keyspace cluster keyspace)
