Skip to content

How to extend Backends with non-scalar functions #8774

Answered by cpcloud
saschahofmann asked this question in Q&A
Discussion options

You must be logged in to vote

@saschahofmann Thanks for raising this.

We removed that section from the docs due to the instability of the internal operations APIs.

Still, I'm glad to hear that it wasn't too bad to update your custom operations.

In your particular case, we do support that operation on JSON typed columns, which you should be able to access from string columns by casting:

In [1]: from ibis.interactive import *

In [2]: t = ibis.literal('{"a":1}')

In [3]: t
Out[3]: '{"a":1}'

In [4]: t.cast("json")
Out[4]: {'a': 1}

In [5]: t.cast("json")["a"]
Out[5]: 1

In [6]: type(t.cast("json")["a"])
Out[6]: ibis.expr.types.json.JSONScalar

In [7]: ibis.to_sql(t.cast("json")["a"])
Out[7]:
SELECT
  CAST('{"a":1}' AS J…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@saschahofmann
Comment options

@cpcloud
Comment options

@cpcloud
Comment options

@saschahofmann
Comment options

Answer selected by saschahofmann
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants