                                               absolute-max-results))))))
 
 
-(defn post-annotate
-  "QP middleware that runs directly after the the query is run and adds metadata as appropriate."
-  [qp]
-  (fn [query]
-    (let [results (qp query)]
-      (if-not (mbql-query? query)
-        ;; non-MBQL queries are not affected
-        results
-        ;; for MBQL queries capture the results and annotate
-        (annotate/annotate query results)))))
-
-
 (defn- pre-log-query [qp]
   (fn [query]
     (when (and (mbql-query? query)

  ;; TODO: it probably makes sense to throw an error or return a failure response here if we can't get a driver
  (let [driver (driver/database-id->driver (:database query))]
    (binding [*driver* driver]
      (let [driver-process-in-context (partial driver/process-query-in-context driver)
            driver-process-query      (partial (if (mbql-query? query)
                                                 driver/process-mbql
                                                 driver/process-native) driver)]
        ((<<- wrap-catch-exceptions
              pre-add-settings
              pre-expand-macros

              cumulative-count
              limit
              post-check-results-format
              pre-log-query
              guard-multiple-calls
              run-query) (assoc query :driver driver))))))


;;; +----------------------------------------------------------------------------------------------------+
