java.jdbc

Add support for (jdbc/query) string keys

Details

  • Type: Feature Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Currently clojure.java.jdbc/query will return a sequence of maps with keyword keys. You can control what the keywords are with the :identifiers option but there is no way to opt out of keyword keys without resorting to the :as-arrays? option and merge back the keys manually.

In some scenarios it's more natural to work with string keys (which is why most clojure json parsers have a way to disable the keywordization of json map keys)

It's also possible for quoted column names to not map well to keywords. For example (jdbc/query db "SELECT 1 as \"a column\"") is perfectly valid sql

Could clojure.java.jdbc provide an option to opt-out of keyword keys?

Activity

Hide
Sean Corfield added a comment -

Added :keywordize? option everywhere that :identifiers is accepted. It defaults to true. Specifying :qualifier as well as :keywordize? false will throw an illegal argument exception. With :keywordize? false only the function passed as :identifiers will be called (which, of course, could call keyword itself at that point!).

Show
Sean Corfield added a comment - Added :keywordize? option everywhere that :identifiers is accepted. It defaults to true. Specifying :qualifier as well as :keywordize? false will throw an illegal argument exception. With :keywordize? false only the function passed as :identifiers will be called (which, of course, could call keyword itself at that point!).
Hide
Sean Corfield added a comment -

Will be in 0.7.3 (which should be on Maven soon).

Show
Sean Corfield added a comment - Will be in 0.7.3 (which should be on Maven soon).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: