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

Support for dropping columns from a database #209

Closed
tdimitrov opened this issue May 11, 2023 · 9 comments · Fixed by #210
Closed

Support for dropping columns from a database #209

tdimitrov opened this issue May 11, 2023 · 9 comments · Fixed by #210
Labels
enhancement New feature or request

Comments

@tdimitrov
Copy link

It would be really nice to have support for dropping arbitrary (or just the last) column from a Database instance.

@tdimitrov tdimitrov added the enhancement New feature or request label May 11, 2023
@cheme
Copy link
Collaborator

cheme commented May 11, 2023

Do you need to change the options of the drop column?

@tdimitrov
Copy link
Author

Do you need to change the options of the drop column?

Probably stupid question, but why would I want to change the options of a column which is going away?

@cheme
Copy link
Collaborator

cheme commented May 11, 2023

you can have an ordered indexed column and switch to non ordered one, or on hash indexed use preimage or something else, I think I will implement an optional change (make sense to me to have it).

@arkpar
Copy link
Member

arkpar commented May 11, 2023

@cheme Changing these options while preserving data is out of scope of this issue. As for the case when loosing data isacceptable, we already have add_column. So remove_column followed by add_column should be enough.

@arkpar
Copy link
Member

arkpar commented May 11, 2023

What kind of "drop" is expected here? Removing a column entirely (and shifting following column indicies)? Or simply clearing all data?

@cheme
Copy link
Collaborator

cheme commented May 11, 2023

I am implementing a full removal (remove at file level, so it is simple to reset different option).
With no indices shift.

@arkpar
Copy link
Member

arkpar commented May 11, 2023

I think proper behaviour for actually removing a column would be to shift following columns and rename their files.
As @tdimitrov suggested, we can just support removing the last column for now. In which case there's no need to rename/move anything.

@cheme
Copy link
Collaborator

cheme commented May 11, 2023

I don t know if the shift could not be something that force user to manage two set of column index so a bit of additional work for him.
Maybe providing an api to move column would work Db::move_column(options, from, to). This way the shift is at convenience of the user.

@tdimitrov
Copy link
Author

you can have an ordered indexed column and switch to non ordered one, or on hash indexed use preimage or something else, I think I will implement an optional change (make sense to me to have it).

No. For my particular case - I want to drop all the data and remove the column from the metadata.

Removing any column would be nice. drop_last + move_column is also acceptable.

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

Successfully merging a pull request may close this issue.

3 participants