       (label-invalid-value session sensor (where-from m)))))
 
 (defn- sensor-exists? [session m]
-  (first (dbnew/execute session
+  (first (db/execute session
                   (hayt/select :sensors
                                (hayt/where (where-from m))))))
 

  [[= :device_id (:device_id m)] [= :type (:type m)]])

(defn- update-sensor [session sensor delta]
  (dbnew/execute session
                 (hayt/update :sensors
                              (hayt/set-columns delta)
                              (hayt/where (where-from sensor)))))

  "Measurement map is pipelines through a number of validation
  functions. Returns map of measurement with updated metadata."
  [store m]
  (db/with-session [session (:hecuba-session store)]
    (let [sensor (sensor-exists? session m)
          events (-> sensor first :events)
          where  (where-from m)
