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

Pipeline stor insert #12859

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bobby-palmer
Copy link

Description

This should fix #11433. Changes allow the stor insert command to accept pipelined input as an alternative to command line argument

User-Facing Changes

No breaking changes, only the addition of this new feature.

Tests + Formatting

Added an example test in stor/insert.rs :

{bool1: true, int1: 5, float1: 1.1, str1: fdncred, datetime1: 2023-04-17} | stor insert --table-name nudb

After Submitting

@bobby-palmer bobby-palmer requested a review from fdncred May 14, 2024 17:20
) -> Result<PipelineData, ShellError> {
let span = call.head;
let table_name: Option<String> = call.get_flag(engine_state, stack, "table-name")?;
let columns: Option<Record> = call.get_flag(engine_state, stack, "data-record")?;
let columns: Option<Record> = match input {
Copy link
Collaborator

@fdncred fdncred May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably check if both input and --data-record parameter are used together and provide an error message. Seems crazy, I know, but people will do it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would ShellError::IncompatibleParameters be the right thing to return from this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, that sounds good.

Copy link
Collaborator

@fdncred fdncred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple more comments. Thanks!

@fdncred
Copy link
Collaborator

fdncred commented May 18, 2024

There is another PR #12882 that helps with this and may supersede this. Do you plan on continuing this?

@NotTheDr01ds
Copy link
Contributor

Also asking the same question here that I did on #12882 - Looking at the commit, this doesn't appear to handle a table type as an input, just a record. Is that correct? into sqlite can handle table or record as input types, and it would be nice to have the same semantics for both into sqlite and stor insert. I was hoping we'd just be able to re-use and share the same code-base for all related commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accept pipeline input for stor insert values
3 participants