                                    (if without-validation
                                      (.withoutValidation transform)
                                      transform))}
+    :with-optimized-writes {:docstr "Allows optimized writes feature, deactivated by default to maintain backward compatibility"
+                            :action (fn [transform bool]
+                                      (when (true? bool)
+                                        (.optimizedWrites transform)))}
     :ignore-unknown-values {:docstr "Ignores fields which does not match the schema."
                             :action (fn [transform ignore-unknown-values]
                                       (if ignore-unknown-values

  (let [tp (doto (TimePartitioning.) (.setType (-> type name .toUpperCase)))]
    (cond-> tp
      (int? expiration-ms)                   (.setExpirationMs expiration-ms)
      (string? field)                        (.setField field)
      (boolean? require-partition-filter)    (.setRequirePartitionFilter require-partition-filter))))

(defn get-bq-table-schema
  "Beware, uses bq util to get the schema!"

   [datasplash.core :as ds])
  (:import
   (com.google.api.services.bigquery.model
    TableRow TableFieldSchema TableSchema TimePartitioning
    Clustering)
   (org.apache.beam.sdk Pipeline)
   (org.apache.beam.sdk.io.gcp.bigquery
    BigQueryIO
