ibis icon indicating copy to clipboard operation
ibis copied to clipboard

feat: SQL arbitrary functions without code modification

Open tsdlovell opened this issue 7 years ago • 2 comments

For tables, you can do client.sql(SQL_STRING) to get an ibis object for an abitrary sql string. If something like this were possible for columns inside of tables, users could use more of the functionality of their particular backend before that functionality is actually built into ibis.

tsdlovell avatar Dec 08 '17 21:12 tsdlovell

I can imagine that as UDFs for sql backends, like for pandas in https://github.com/ibis-project/ibis/pull/1277

Translator helpers like sa.func.<name> could be handy too.

kszucs avatar Jan 22 '18 21:01 kszucs

For example:

from ibis.func import from_base64

t = ibis.table(dict(a="binary"))
from_base64(t.a, output_type="string")

cpcloud avatar Apr 27 '22 20:04 cpcloud

This is possible with .sql:

t.alias('my_table').sql("SELECT GREAT_FUNCTION(x) FROM my_table")

cpcloud avatar Aug 31 '22 21:08 cpcloud