Skip to content

Supporting multi-row inserts with IEnumerable<IEnumerable<KeyValuePair<string, object>>> #663

Open
@lilacse

Description

@lilacse

Hi,

Since SqlKata supports creating insert queries from an IEnumerable<KeyValuePair<string, object>>, I think it would be great if we can also have an AsInsert() overload that takes an enumerable of that. List of dictionaries are quite common as a data structure as well, so I think this will be a useful addition.

I am interested in making a PR myself to implement that, but there's just one thing I'm not sure about - the most common implementation of IEnumerable<IEnumerable<KeyValuePair<string, object>>> might just be a list of dictionaries, and ordering of key-value pairs in dictionaries are not promised. Hence the code will need to reorder the entries, or iterate through the keys obtained from the first dictionary for every subsequent dictionary in the list to produce the correct output every time. Not very sure if this will be a concern (performance?) or which is the better approach in this case, so I hope to have some discussion on this before I start to try working on this :)

I also noticed that there was this PR #548 which seems to cover this (except for the ordering concern), but it's quite old and includes much more changes other than this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions