Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: .insert() uses column position, not names, to align #9249

Closed
1 task done
NickCrews opened this issue May 24, 2024 · 1 comment · Fixed by #9264
Closed
1 task done

bug: .insert() uses column position, not names, to align #9249

NickCrews opened this issue May 24, 2024 · 1 comment · Fixed by #9264
Assignees
Labels
bug Incorrect behavior inside of ibis

Comments

@NickCrews
Copy link
Contributor

What happened?

When I insert new data, I expect the columns to get aligned by name. But we seem to be naive, and not ensure the src and dst schemas are in the same order, and thus we get the default SQL behavior of data being aligned by position:

import ibis

ibis.options.interactive = True

db = ibis.duckdb.connect()
db.create_table("t", [{"a": 1, "b": 2}])
db.insert("t", [{"b": 22, "a": 11}])
db.table("t")
# ┏━━━━━━━┳━━━━━━━┓
# ┃ a     ┃ b     ┃
# ┡━━━━━━━╇━━━━━━━┩
# │ int64 │ int64 │
# ├───────┼───────┤
# │     1 │     2 │
# │    22 │    11 │
# └───────┴───────┘

What version of ibis are you using?

main

What backend(s) are you using, if any?

duckdb, but I bet this is present in other backends too.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@NickCrews NickCrews added the bug Incorrect behavior inside of ibis label May 24, 2024
@gforsyth
Copy link
Member

Nice catch, @NickCrews -- I've got a reasonably straightforward fix for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior inside of ibis
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

2 participants