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

New add row api #7

Closed
root-11 opened this issue Oct 30, 2020 · 2 comments
Closed

New add row api #7

root-11 opened this issue Oct 30, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@root-11
Copy link
Owner

root-11 commented Oct 30, 2020

Users have reported that add_row is clunky to work with. Hence the following API is suggested:

Example:

    t = Table()
    t.add_column('A', int)
    t.add_column('B', int)
    t.add_column('C', int)

The following examples are all valid and append the row (1,2,3) to the table.

    t.add_row(1,2,3)
    t.add_row([1,2,3])
    t.add_row((1,2,3))
    t.add_row(*(1,2,3))
    t.add_row(A=1, B=2, C=3)
    t.add_row(**{'A':1, 'B':2, 'C':3})

The following examples add two rows to the table

    t.add_row((1,2,3), (4,5,6))  # adds two rows.
    t.add_row([1,2,3], [4,5,6])
    t.add_row({'A':1, 'B':2, 'C':3}, {'A':4, 'B':5, 'C':6}) # two (or more) dicts as args.
    t.add_row([{'A':1, 'B':2, 'C':3}, {'A':1, 'B':2, 'C':3}]]) # list of dicts.

Please vote & comment.

@root-11 root-11 self-assigned this Oct 30, 2020
@root-11 root-11 added the enhancement New feature or request label Oct 30, 2020
root-11 pushed a commit that referenced this issue Oct 30, 2020
@root-11
Copy link
Owner Author

root-11 commented Oct 30, 2020

Done in e09c4ee

@root-11
Copy link
Owner Author

root-11 commented Oct 30, 2020

Packaged to pypi as https://pypi.org/project/tablite/2020.10.30.46577/

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

No branches or pull requests

1 participant