 (defn describe-database
   [driver database]
   (with-metadata [metadata driver database]
-    {:tables (active-tables driver metadata)}))
+    {:tables (active-tables driver, ^DatabaseMetaData metadata)}))
 
 (defn describe-table
   [driver table]

(defn post-filtered-active-tables
  "Alternative implementation of `IDriver/active-tables` best suited for DBs with little or no support for schemas.
   Fetch *all* Tables, then filter out ones whose schema is in `excluded-schemas` Clojure-side."
  [driver metadata]
  (set (for [table (filter #(not (contains? (excluded-schemas driver) (:table_schem %)))
                           (jdbc/result-set-seq (.getTables metadata nil nil nil (into-array String ["TABLE", "VIEW"]))))]
         {:name   (:table_name table)
          :schema (:table_schem table)})))

(defn- describe-table-fields
  [metadata driver {:keys [schema name]}]
  (set (for [{:keys [column_name type_name]} (jdbc/result-set-seq (.getColumns metadata nil schema name nil))
             :let [calculated-special-type (column->special-type driver column_name (keyword type_name))]]
         (merge {:name        column_name

                  {:special-type calculated-special-type})))))

(defn- add-table-pks
  [^DatabaseMetaData metadata, table]
  (let [pks (->> (.getPrimaryKeys metadata nil nil (:name table))
                 jdbc/result-set-seq
                 (mapv :column_name)
