Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow korma to specify extra parameters to defdb #373

Open
mprokopov opened this issue Dec 29, 2016 · 5 comments
Open

Allow korma to specify extra parameters to defdb #373

mprokopov opened this issue Dec 29, 2016 · 5 comments
Labels
inactive-issue? This issue should be closed within 2 weeks of the most recent comment due to inactivity

Comments

@mprokopov
Copy link

mprokopov commented Dec 29, 2016

I faced to following issue with local timezone using mysql
http://stackoverflow.com/questions/26515700/mysql-jdbc-driver-5-1-33-time-zone-issue

And I did some workaround for that:

(def db-params (mysql {:host "localhost"
                      :db "itservice"
                      :user "root"}))

(def extra-params {:useLegacyDatetimeCode false
               :serverTimezone "UTC"
               :useSSL false})

(def subparams (->> (map (fn [[k v]] (str (name k) "=" v)) extra-params)
                (clojure.string/join "&")
                (str "?")))
(def new-params (update db-params :subname #(str % subparams)))
(defdb my-db new-params)

so params string should look something like "//localhost:3306/itservice?useLegacyDatetimeCode=false&serverTimezone=UTC&useSSL=false", and there is no support for such extra parameters for db-params.

@ls4f
Copy link
Contributor

ls4f commented Dec 29, 2016

Will mysql accept those extra parameters as properties (instead of URL params)? Korma does pass on any extra keys you might've set to the data source.

@mprokopov
Copy link
Author

I've created pull request for proper support of extra parameters.

#374

@ls4f
Copy link
Contributor

ls4f commented Dec 30, 2016

While I'm not a maintainer, if the functionality is needed (some drivers might indeed require options be set via the URL), it seems better to handle it in defdb and make it work for any and all possible databases.

@venantius
Copy link
Contributor

I've commented on your PR, but I appreciate that both it and this issue are quite old.

Is this still a priority issue?

If there hasn't been a response to this issue in 2 weeks, I'll close the ticket.

@venantius venantius added the inactive-issue? This issue should be closed within 2 weeks of the most recent comment due to inactivity label Feb 27, 2018
@Janderio
Copy link

I had the same problem (timezone) until configure the server correct, the parameters would be great addition if possible to work even if you can't access the servers config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inactive-issue? This issue should be closed within 2 weeks of the most recent comment due to inactivity
Projects
None yet
Development

No branches or pull requests

4 participants