nushell: Can't insert null `into sqlite` since 0.90

Describe the bug

Can no longer insert a null via into sqlite.

How to reproduce

> [
  { name: 'foo', modified_date: 1710703657 }
  { name: 'bar', modified_date: null}
]
| into sqlite foo.sqlite

Result:

Error: nu::shell::only_supports_this_input_type

  × Input type not supported.
   ╭─[source:1:1]
 1 │ nu --login
   · ▲
   · ╰── only bool, int, float, filesize, duration, date, string, nothing, binary input data is supported
   ╰────
   ╭─[entry #1:3:33]
 2 │   { name: 'foo', modified_date: 1710703657 }
 3 │   { name: 'bar', modified_date: null}
   ·                                 ──┬─
   ·                                   ╰── input type: nothing
 4 │ ] | into sqlite foo.sqlite
   ╰────

Expected behavior

In 0.89, this worked fine.

> [
  { name: 'foo', modified_date: 1710703657 }
  { name: 'bar', modified_date: null}
]
| into sqlite foo.sqlite
> open foo.sqlite
╭──────┬──────────────────────────────╮
│      │ ╭───┬──────┬───────────────╮ │
│ main │ │ # │ name │ modified_date │ │
│      │ ├───┼──────┼───────────────┤ │
│      │ │ 0 │ foo  │    1710703657 │ │
│      │ │ 1 │ bar  │               │ │
│      │ ╰───┴──────┴───────────────╯ │
╰──────┴──────────────────────────────╯

Screenshots

No response

Configuration

key value
version 0.91.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.76.0 (07dca489a 2024-02-04) (built from a source tarball)
cargo_version cargo 1.76.0
build_time 1980-01-01 00:00:00 +00:00
build_rust_channel release
allocator mimalloc
features dataframe, default, extra, sqlite, trash, which, zip
installed_plugins

Additional context

I believe this change came with #10232 since that’s the only into sqlite related change in 0.90.

This is a pretty big issue for me, and I haven’t found a workaround yet other than continuing to run under 0.89. Took me a while to notice it since I skipped 0.90.

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Comments: 19 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Oops, yeah, looks like I missed null. 😬 My bad. I can write up a patch when I get some time.

Thank you both! Tested and confirmed that my script works again with the commit.

Ok I have a PR up: #12328

Ok, I’ll just go with defaulting to text for now and make a follow-up PR to specify a schema. But I do think it at least warrants a warning to the user, so I’ll print a message to stderr when it makes this decision.