You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm trying to build a naive offline-first sync logic by storing all database operations on the client in a log table before attempting to sync the operations with a remote server. If I use the QueryInterceptor to intercept all operations and insert into log table I'd create an infinite loop of insert -> intercept -> insert, unless I string-parse the table names from the statement string and avoid logging when log table statements are intercepted. I was wondering if it would be possible to exclude a set of tables from being intercepted from the API side.
(Btw, thank you for building QueryInterceptor. I thought I would have to manually parse SQL for a little while before I found this gem buried in the Drift docs).
Describe the solution you'd like
A way to manage which tables are intercepted by QueryInterceptor by defining a set of tables that are excluded from being intercepted. Either at the class level or at the .interceptWith() level would work.
This excludedTables getter would also have to work for custom inserts being passed to runInsert, and we simply don't have the information about the table available there.
table I'd create an infinite loop of insert -> intercept -> insert
Hm, if you have a second database instance that points to the same underlying query executor but without the interceptor you'd be fine, right? Then you can use that database for the sole purpose maintaining the log table.
An alternative would be to use the sqlparser package to parse the statements and determine the table through that - but I think sidestepping the interceptor by using a second database is the easier approach.
Is your feature request related to a problem? Please describe.
I'm trying to build a naive offline-first sync logic by storing all database operations on the client in a log table before attempting to sync the operations with a remote server. If I use the
QueryInterceptor
to intercept all operations and insert into log table I'd create an infinite loop of insert -> intercept -> insert, unless I string-parse the table names from thestatement
string and avoid logging when log table statements are intercepted. I was wondering if it would be possible to exclude a set of tables from being intercepted from the API side.(Btw, thank you for building QueryInterceptor. I thought I would have to manually parse SQL for a little while before I found this gem buried in the Drift docs).
Describe the solution you'd like
A way to manage which tables are intercepted by
QueryInterceptor
by defining a set of tables that are excluded from being intercepted. Either at the class level or at the.interceptWith()
level would work.or
The text was updated successfully, but these errors were encountered: