Calling for opinions: incompatibility between v0.x and v1 #33
mirakui
announced in
Announcements
Replies: 1 comment
-
|
@mirakui Hello, We are using Blouson::SensitiveTableQueryLogSilencer from cookpad/blouson. It uses Arproxy and silences logs by wrapping |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There are several incompatible changes from Arproxy v0.x to v1.
In most cases, existing configurations can be used as-is in v1, but there are some exceptions.
The specification of custom proxies (classes inheriting from Arproxy::Base) has changed as follows:
1. Removal of keyword arguments (kwargs)
In v0.2.9,
**kwargswas added to the arguments of the#executemethod (#21), but this argument has been removed in v1.These
kwargswere removed in v1 because their specifications differed depending on the Connection Adapter of each database.2.
Arproxy::Base#execute(super) no longer executes queriesIn v0.x, the
Arproxy::Base#executemethod was a method to execute a query on the Database Adapter.That is, when
superis called in the#executemethod of a custom proxy, a query is executed on the Database Adapter at the end of the proxy chain.In v1, the
Arproxy::Base#executemethod does not execute a query. The query is executed outside the#executemethod after the proxy chain of#executeis complete.This change was necessary to support various Database Adapters while maintaining backward compatibility with custom proxies as much as possible.
However, this change has the following incompatibilities:
supercannot be used.2.1. The return value of
supercannot be usedIn v0.x, the return value of
superwas the result of actually executing a query on the Database Adapter.For example, if you are using the
mysql2Adapter, the return value ofsuperwas aMysql2::Resultobject.In v1, the return value of
superis a value used internally by Arproxy's proxy chain instead of the result of actually executing a query on the Database Adapter.You still need to return the return value of
superin the#executemethod of your custom proxy.However, the
Arproxy::Basein v1 does not expect to use this return value in the custom proxy.If your custom proxy expects the return value of
superto be an object representing the query result, you need to be careful because it is not available in v1.2.2. The query execution time cannot be measured
For example, even if you write code to measure the execution time of
super, it no longer means the query execution time.Discussion
The specification changes in v1 have allowed more Database Adapters to be supported and made Arproxy more resistant to changes in ActiveRecord's internal structure.
However, as described in the previous section, there are cases where the custom proxies written in v0.x will no longer work.
We do not know the use cases of Arproxy users other than ourselves very well, so we are soliciting opinions on the changes in this time.
If there are many requests, we will prepare a new base class for custom proxies with a different interface from
Arproxy::Base, so that custom proxy writing similar to that in v0.x can be done.Beta Was this translation helpful? Give feedback.
All reactions