Skip to content

How does one control the column datatype to be non-null in a mutate? #7243

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

You must be logged in to vote

@seandavi Thanks for opening a discussion!

You should be able to use notation similar to what shows up in the t1.schema() for the pmid2 column. The ! character indicates a type that is not nullable.

You should be able to use the Table.cast method for this:

In [1]: from ibis.interactive import *

In [2]: con = ibis.clickhouse.connect(host="localhost", database="ibis_testing")

In [3]: t = ibis.memtable({"words": [["hello", "goodbye"], ["wat"]]})

In [4]: s = con.create_table("test", t.cast({"words": "!array<string>"}))

In [5]: s
Out[5]:
┏━━━━━━━━━━━━━━━━━━━━━━┓
┃ words                ┃
┡━━━━━━━━━━━━━━━━━━━━━━┩
│ !array<string>       │
├──────────────────────┤
│ ['hello', 'goodbye'] │
│ ['…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by seandavi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
clickhouse The ClickHouse backend question Questions about the library
2 participants