                             (into-array BigQuery$TableListOption []))
                (.iterateAll))]
     (map to-clojure (iterator-seq it))))
+
+(defn table [service {:keys [project-id dataset-id table-id] :as table}]
+  (to-clojure (.getTable service
+                         (TableId/of project-id dataset-id table-id)
+                         (into-array BigQuery$TableOption []))))
 
 (defn create-dataset [service {:keys [project-id dataset-id friendly-name location description table-lifetime-millis] :as dataset}]
   (let [locations {:eu "EU"

(defn create-table
  "Fields: sequence of fields representing the table schema.
  e.g. [{:name \"foo\" :type :record :fields [{:name \"bar\" :type :integer}]}]"
  [service {:keys [project-id dataset-id table-id]} fields]
  (let [builder (TableInfo/builder (TableId/of project-id dataset-id table-id)
                                   (mkschema fields))
        table-info (.build builder)]
    (to-clojure (.create service table-info (into-array BigQuery$TableOption [])))))

                   :creation-time      (.creationTime x)
                   :expiration-time    (.expirationTime x)
                   :last-modified-time (.lastModifiedTime x)
                   :streaming-buffer   (when-let [sb (.streamingBuffer x)]
                                         (to-clojure sb))
                   :table-id           (to-clojure (.tableId x))})
  BigQueryError
  (to-clojure [x] {:reason   (.reason x)
                   :location (.location x)
                   :message  (.message x)})
  InsertAllResponse
  (to-clojure [x] {:errors (->> (.insertErrors x)
                                (map (fn [[idx errors]]
                                       {:index  idx
                                        :errors (map to-clojure errors)}))
                                (seq))}))

(defn service
  ([] (.service (BigQueryOptions/defaultInstance))))
