feat(ddl): disallow inserting by position, require source columns to be subset of target columns#11776
feat(ddl): disallow inserting by position, require source columns to be subset of target columns#11776NickCrews wants to merge 1 commit intoibis-project:mainfrom
Conversation
|
@deepyaman this is related to your upsert PR, if you want to give it a look. I don't think there is any ordering needed between the two, but I do think it would be great if this PR was included in the same release as that PR, so that the .upsert() API never goes through a breaking change. |
d67de9c to
6fe21f7
Compare
c9dd811 to
d74fdf0
Compare
da91ef7 to
036ecea
Compare
| assert t.count().execute() == 2 | ||
|
|
||
| con.insert(name, [(1,), (2,)]) | ||
| assert t.count().execute() == 4 |
There was a problem hiding this comment.
This actually is still supported if we keep the second commit, I just forgot to un-delete it.
There was a problem hiding this comment.
This is now tested across all backends in test_insert_overwrite_from_list() in ibis/backends/tests/test_client.py
|
@cpcloud can I get confirmation this is the right idea before I do the rebase and fixup the tests? |
036ecea to
1b324bb
Compare
gforsyth
left a comment
There was a problem hiding this comment.
Hey @NickCrews -- I think this is a good change/fix. I DO think we should keep positional inserts for tables without column names -- it does make everything messier, but it's a nice convenience.
I haven't taken a deep reviewing pass on this yet, but I think this is the right approach.
|
Thanks for the reviews @gforsyth and @deepyaman , I'll get this fixed up per your suggestions! |
1b324bb to
8052056
Compare
|
This PR has gotten quite large. If you want, I can split it up a bit. I think the lowest hanging fruit would be to fix the impala DDL compiler first in a separate PR, that doesn't require any of the .insert() changes. Then, potentially could split out the typing changes, adding the IntoMemtable TypeAlias. Then, could actually get to the .insert() stuff. |
b523876 to
305f9fd
Compare
|
@gforsyth and @deepyaman this is ready for your review (or telling me to split it into smaller PRs) whenever you get some time. Thanks! I'm also happy to video chat about any of this if that is easier at all. |
|
Hey @NickCrews -- I think your suggestion to break up this PR is a good one. |
…fiers and strings (#11942) Before, it was inserting by position of the passed in table. I started this in #11776, but then that got too big, so this is just this bugfix for impala. Now the groundwork is laid for the rest of that PR. @gforsyth, this is ready for review as soon as it passes CI. Thanks!
305f9fd to
8eb38c7
Compare
… of target columns
8eb38c7 to
7ae6006
Compare
| [ | ||
| param([{"a": 1, "b": 2}], [{"b": 22, "a": 11}], id="column order reversed"), | ||
| param([{"a": 1, "b": 2}], [{"a": 11, "b": 22}], id="column order matching"), | ||
| param( |
There was a problem hiding this comment.
this is now tested in test_insert_overwrite_from_list
|
Boom, finally this is simplified and ready to go, whenever you get the chance @gforsyth @deepyaman @cpcloud |
After slowly picking apart the prerequisites for this PR, I think it is finally focused enough to actually tackle! Resolves #11731
This is breaking, but probably not for a huge fraction of users (???). Currently, on main, this works, aligning by position:
After this PR, the above errors, which I think it is good.
Currently, on main, this (inserting data with anonymous column names) works, and after this PR it will continue to work. Originally in this PR I dropped support for this, hence you can see some comments in the thread below. But after that discussion we decided to keep supporting this.
A summary of the changes are
con.insert("table", [(1,2), (3,4)])