 (declare build-query
          generate-sql)
 
-(defn annotate-column [table column]
+(defn annotate-column
+  "Add the following keys to COLUMN (used internally):
+  *  `:keyword` Used for keying some internal maps (?)
+  *  `:qualified-name` Name to be used in the `SELECT` statement, e.g. `\"main_guide\".\"user_id\"`
+  *  `:alias` Alias for the field in `SELECT` statements (needed in some cases where we cast fields such as Dates)
+  *  `:select` Combined qualified name/alias form to use in `SELECT` statement, e.g. `\"main_guide\".\"user_id\" AS `\"main_guide\"`"
+  [table column]
   (let [{:keys [name base_type]} column
         qualified-name (format "\"%s\".\"%s\"" (:name table) name)
         alias (match base_type

         (apply str))))

(defn process-and-run [{:keys [database] :as query}]
  (let [{:keys [sql columns ordered-columns columns-by-name] :as query-dict} (process (:query query))
        db (sel :one Database :id database)
        results ((:native-query db) sql)]
    (println "----------------------------------------\n"

           :alias alias
           :select select)))

(defn annotate-column-with-id
  "Fetch `Field` with COLUMN-ID and call `annotate-column`."
  [table column-id]
  {:pre [(integer? column-id)]}
  (annotate-column table (sel :one Field :id column-id)))

(defn annotate-special-column [column]
