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]: Deprecate the ability to add scalar for a ragged column #1211

Open
rly opened this issue Nov 14, 2024 · 0 comments
Open

[Bug]: Deprecate the ability to add scalar for a ragged column #1211

rly opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)
Milestone

Comments

@rly
Copy link
Contributor

rly commented Nov 14, 2024

What happened?

Currently, you can call table.add_row to add a scalar value to a ragged column. If the scalar is a string, then the characters of the string are broken up and stored as characters in the ragged column. To prevent this and provide a clearer API, add_row should not allow taking a scalar value to a ragged column.

Fixing this would be a breaking change. We should first deprecate the use of table.add_row to add a scalar value to a ragged column.

Steps to Reproduce

from hdmf.common import DynamicTable
dt = DynamicTable(name="test", description="desc")
dt.add_column(name="col1", description="desc", index=True)
dt.add_row(col1="hello")  # this should not be allowed. only dt.add_row(col1=["hello"]) should be allowed
dt["col1"][:]  # returns [['h', 'e', 'l', 'l', 'o']]

Traceback

No response

Operating System

macOS

Python Executable

Conda

Python Version

3.12

Package Versions

No response

@rly rly added the category: bug errors in the code or code behavior label Nov 14, 2024
@rly rly added this to the Future milestone Nov 14, 2024
@rly rly added category: enhancement improvements of code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s) and removed category: bug errors in the code or code behavior labels Nov 15, 2024
@rly rly changed the title [Bug]: Deprecate the ability to add scalar for a ragged column [Feature]: Deprecate the ability to add scalar for a ragged column Nov 15, 2024
@rly rly changed the title [Feature]: Deprecate the ability to add scalar for a ragged column [Bug]: Deprecate the ability to add scalar for a ragged column Nov 15, 2024
@rly rly added category: bug errors in the code or code behavior and removed category: enhancement improvements of code or code behavior labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: low alternative solution already working and/or relevant to only specific user(s)
Projects
None yet
Development

No branches or pull requests

2 participants