This repository was archived by the owner on Mar 22, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
src/googlesheets_sql_sync Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1- (defproject googlesheets-sql-sync " 0.5.0 "
1+ (defproject googlesheets-sql-sync " 0.5.1 "
22 :description " Keep your SQL database in sync with Google Sheets"
33 :url " https://github.com/jorinvo/googlesheets-sql-sync"
44 :license {:name " MIT"
Original file line number Diff line number Diff line change 55 [googlesheets-sql-sync.log :as log]
66 [googlesheets-sql-sync.util :refer [fail]]))
77
8+ (def identifier-quoting-map
9+ {:postgresql " \" "
10+ :mysql " `" })
11+
812(defn- escape
913 " Replace all c in text with \\ c"
1014 [text c]
8791(defn update-table [config sheet]
8892 (let [target (-> sheet :sheet :target )
8993 db (get-in config [:targets (keyword target)])
94+ identifier-quoting (:dbtype identifier-quoting-map)
9095 table (-> sheet :sheet :table )
9196 rows (:rows sheet)
9297 headers (->> rows
9398 first
94- (map #(escape % " \" " )))
95- escaped-headers (map #(str " \" " % " \" " ) headers)
99+ (map #(escape % identifier-quoting )))
100+ escaped-headers (map #(str identifier-quoting % identifier-quoting ) headers)
96101 header-count (count headers)
97102 data (->> (rest rows)
98103 (map #(map string/trim %))
You can’t perform that action at this time.
0 commit comments