Created
January 10, 2011 16:05
-
-
Save bendlas/772953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gist | |
(:require [clojureql.core :as cql])) | |
(def schema-tables | |
(cql/select | |
(cql/table *db* :information_schema.tables) | |
(cql/where (= :table_schema "public")))) | |
(def table-columns | |
(cql/project | |
(cql/table server/*db* :information_schema.columns) | |
[:data_type])) | |
(def table-desc | |
(cql/join schema-tables table-columns :table_name)) | |
@table-desc | |
;; throws (PG), since column :table_schema is ambigous | |
;; current workaround is to write the WHERE clause as (= :tables.table_schema "public") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment