Guest User

Untitled

a guest
Jul 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. (ns gist
  2. (:require [clojureql.core :as cql]))
  3.  
  4. (def schema-tables
  5. (cql/select
  6. (cql/table *db* :information_schema.tables)
  7. (cql/where (= :table_schema "public"))))
  8.  
  9. (def table-columns
  10. (cql/project
  11. (cql/table server/*db* :information_schema.columns)
  12. [:data_type]))
  13.  
  14. (def table-desc
  15. (cql/join schema-tables table-columns :table_name))
  16.  
  17. @table-desc
  18. ;; throws (PG), since column :table_schema is ambigous
  19. ;; current workaround is to write the WHERE clause as (= :tables.table_schema "public")
Add Comment
Please, Sign In to add comment