 (defmethod get-primary-key-field :project [typ] :id)
 (defmethod get-primary-key-field :entity [typ] :id)
 (defmethod get-primary-key-field :device [typ] :id)
+(defmethod get-primary-key-field :profile [typ] :id)
 (defmethod get-primary-key-field :user [typ] :id) ; TODO should be username...
 (defmethod get-primary-key-field :user-session [typ] :id)
 (defmethod get-primary-key-field :dataset [typ] :id)

  (update! [_ typ payload where]
    (assert where "No where clause")
    (alia/execute session
     (hayt/update (get-table typ) 
                  (hayt/set-columns (cassandraify payload))
                  (hayt/where (cassandraify-v where)))))


(defmethod gen-key :project [typ payload] ((sha1-keyfn :name :programme-id) payload))
(defmethod gen-key :entity [typ payload] ((sha1-keyfn :property-code :project-id) payload))
(defmethod gen-key :device [typ payload] ((sha1-keyfn :description :entity-id) payload))
(defmethod gen-key :profile [typ payload] ((sha1-keyfn :timestamp :entity-id) payload))

(defmethod gen-key :sensor [typ payload] nil)
(defmethod gen-key :sensor-metadata [typ payload] nil)
