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
In sql_substr() we have an example showing us how to add a new variant.
I think I understand the general mechanism, sql_variant() receives "translators" which are environments containing functions creating strings of class "sql". I see also that sql_translator() has a .parent arg so we can inherit from a higher level translator.
But I don't quite understand how to idiomatically add a new translation to an existing variant.
A hack that I think will work OK for my project is to edit the base_odbc_scalar, base_odbc_agg, and base_odbc_win environments directly since they're exported and not locked, another would be to overwrite dbplyr:::sql_translation.Oracle (Since that's Oracle in my case) but seems a bit clunky as well.
I thought about using a super class of my "Oracle" too but it seems I'd have to set new methods for at least tbl() and probably more, that seems like a rabbit hole.
My use case FWIW is to add a series of functions such as count_if(), which don't exist in neither R or Oracle, I'd like also to implement some translations from str_replace to REGEXP_EXTRACT, the general idea is that I'd like this code to work the same before or after collecting.
Can you recommend a way to go at this ?
The text was updated successfully, but these errors were encountered:
In
sql_substr()
we have an example showing us how to add a new variant.I think I understand the general mechanism,
sql_variant()
receives "translators" which are environments containing functions creating strings of class "sql". I see also thatsql_translator()
has a.parent
arg so we can inherit from a higher level translator.But I don't quite understand how to idiomatically add a new translation to an existing variant.
A hack that I think will work OK for my project is to edit the
base_odbc_scalar
,base_odbc_agg
, andbase_odbc_win
environments directly since they're exported and not locked, another would be to overwritedbplyr:::sql_translation.Oracle
(Since that's Oracle in my case) but seems a bit clunky as well.I thought about using a super class of my "Oracle" too but it seems I'd have to set new methods for at least
tbl()
and probably more, that seems like a rabbit hole.My use case FWIW is to add a series of functions such as
count_if()
, which don't exist in neither R or Oracle, I'd like also to implement some translations from str_replace to REGEXP_EXTRACT, the general idea is that I'd like this code to work the same before or after collecting.Can you recommend a way to go at this ?
The text was updated successfully, but these errors were encountered: