Giter Site home page Giter Site logo

database.sql.hikaricp's People

Contributors

bgalartza avatar kkharji avatar weavejester avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

database.sql.hikaricp's Issues

Make jdbc-url and connection-uri optional

As the README states:

The key takes the same config options as the Clojure hikari-cp wrapper library.

Those HikariCP configuration options allow us to specify the connection details by supplying the individual options:

  • adapter
  • server-name
  • port-number
  • username
  • password
  • database-name
  • ...

instead of a single jdbc-url or connection-uri. But database.sql.hikaricp assumes that there will always be a jdbc-url or connection-uri option provided. And unconditionally sets the jdbc-url option in the map passed to hikari-cp/make-datasource.

Because hikari-cp/make-datasource checks the validity of the jdbc-url option (and throws an exception if it doesn't like it), that means that even if we provide individual options that are valid and sufficient to create the datasource, we will still need to provide a fake (but still valid-looking) jdbc-url or connection-uri. Even if that fake jdbc-url/connection-uri is completely ignored by hikari-cp/make-datasource in this case.

So we propose to make jdbc-url/connection-uri completely optional. And we would be glad to provide a pull request for that change.

Disable query logging

I need to be able to disable the query logging on a per-query basis, as, in general, I like having the logging, but for some query I don't want logging.

The use cases are:

  1. Sometimes queries contain data which you don't want logged, like password hashes or Personally Identifiable Information (especially if logs are forwarded to a third party logging service, it may even not be legal to do so in some cases and jurisdictions)
  2. Sometimes queries contain data which is very large and would cause logs to be excessively large (eg I sometimes need to store binary data or larger text content)

In both cases, only some queries are affected, so it would be good to only disable logging for those, rather than globally. Technically only the affected values need to be masked, but I don't know of any way to do that.

Looking at the code, it looks like I can disable logging globally for all queries by not passing a logger to the component, but I'm not actually sure how -- I haven't explicitly set a logger for the hikaricp component in my duct config but it still seems to get one (maybe I'm missing something), otherwise I could work around this by having two components: one with logging and one without, although then it applies to an entire transaction (plus the awkwardness of having two DB objects in components that need this).

I can open a PR, if you give me your thoughts on this. My initial thought is to introduce a dynamic var which defaults to "log enabled" that can be set, something like: (binding [duct.database.sql.hikaricp/*logging* true] (sql-statement)) although I don't actually know how the proxy datasource works -- is afterQuery called in the same thread a the caller? Alternatively, perhaps the datasource can be temporarily unwrapped.

Is there any way to disable query log?

Hi,

I want to disable query logs by configuration.
Is there any way to do this or change the log level of query log?

I don't want to enable/disable query log per query like issue #3 .
I Just want to disable all query logs.

Thank you.

Datasource cannot be closed when `reset` or `halt`

When upgrade to database.sql.hikaricp 0.3.0, when reset the following exception is thrown.

(reset)
ClassCastException net.ttddyy.dsproxy.support.ProxyDataSource cannot be cast to com.zaxxer.hikari.HikariDataSource  hikari-cp.core/close-datasource (core.clj:213)
*e
=>
#error{:cause "net.ttddyy.dsproxy.support.ProxyDataSource cannot be cast to com.zaxxer.hikari.HikariDataSource",

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.