     (client/execute cluster (client/render-query query))))
 
 (defn get-tattr [cluster k name time]
-  (let [[bucket hitime] (take 2 (decode-time time))]
-    (mapcat
+  (let [[bucket slot] (decode-time time)]
+    (map
      (fn [row]
-       (map
-        (fn [[lotime value]]
-          [(encode-time bucket (:hitime row) lotime) (f/binary-to-bytes value)])
-        (:data row)))
+       [(encode-time bucket (:slot row)) (f/binary-to-bytes (:data row))])
      (select cluster
              :t_attr
-             (columns :hitime :data)
-             (where :key k :name name :bucket bucket :hitime [:>= hitime])))))
+             (columns :slot :data)
+             (where :key k :name name :bucket bucket :slot [:>= slot])))))
 
 (defn del-tattr [cluster attrs]
   (let [query (->> attrs


(defn fmt-put-tattr [[data opts0]]
  (let [opts (flatten (seq (dissoc opts0 :index)))
        [bucket hitime lotime] (decode-time (:time data))
        idx (if (:index opts0)
              [(fmt-put-index-opts :t_index
                                   {:key (:key data)
                                    :name (:name data)} opts)]
              [])]
    (if (empty? opts)
      (cons (update-query :t_attr
                          {:data [+ {lotime (:value data)}]}
                          (where
                           :key (:key data)
                           :name (:name data)
                           :bucket bucket
                           :hitime hitime)) idx)
      (cons (update-query :t_attr
                          {:data [+ {lotime (:value data)}]}
                          (where
                           :key (:key data)
                           :name (:name data)
                           :bucket bucket
                           :hitime hitime)
                           (apply using opts)) idx))))

(defn fmt-del-kattr [data]

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