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
Specifically, I want to be able to to s = ibis.struct(my_table), or {"col1": "default_that_might_be_overwritten", **table, "col2": "always_this_val"}
Describe the solution you'd like
Per #8671 (comment), all that needs to be present is .keys(self) and __getitem__(self, key). So the only thing that is missing is .keys().
This is similar to #8671. See that PR for a few downsides of this approach. Specifically addressing them here:
this pollutes the namespace, so now if you have a column called "keys" (which honestly seems pretty likely), then if you try to access that column via table.keys you now get an error. You would need to do table["keys"]. This is the reason I didn't add .values() and .items() methods as well.
To fully follow the collections.abc.Mapping, we would also need to implement __len__(), which I think we all have decided is a footgun and not a good idea.
That PR suffered from the problem that **StructValue implied that **MapValue and *ArrayValue might work (but they never could). On a Table, we don't suffer from this possible point of confusion.
IDK, maybe these downsides are not worth it, **{c: table[c] for c in table.columns} is not that painful.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
Specifically, I want to be able to to
s = ibis.struct(my_table)
, or{"col1": "default_that_might_be_overwritten", **table, "col2": "always_this_val"}
Describe the solution you'd like
Per #8671 (comment), all that needs to be present is
.keys(self)
and__getitem__(self, key)
. So the only thing that is missing is.keys()
.This is similar to #8671. See that PR for a few downsides of this approach. Specifically addressing them here:
table.keys
you now get an error. You would need to dotable["keys"]
. This is the reason I didn't add .values() and .items() methods as well.collections.abc.Mapping
, we would also need to implement__len__()
, which I think we all have decided is a footgun and not a good idea.IDK, maybe these downsides are not worth it,
**{c: table[c] for c in table.columns}
is not that painful.Code of Conduct
The text was updated successfully, but these errors were encountered: