duct-framework / database.sql.hikaricp Goto Github PK
View Code? Open in Web Editor NEWIntegrant methods for a SQL database connection pool
Integrant methods for a SQL database connection pool
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.
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:
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.
Hi,
I pushed new PR to support changing log level of SQL (#14 ).
I think It likes duct-framework/module.web#20
Thank you.
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.
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",
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.