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

feature request: allow custom key creation based on record data #8

Open
Josverl opened this issue Aug 28, 2022 · 2 comments
Open

feature request: allow custom key creation based on record data #8

Josverl opened this issue Aug 28, 2022 · 2 comments

Comments

@Josverl
Copy link

Josverl commented Aug 28, 2022

I would like to be able to create an id by either specifying the id when adding, or by creating the id based on the record data passed in.
While it is currently possible to add a custom id, the _id_generator method is not passed the new object.

While it is simple to override the ._id_generator itself ,
In the current implementation I would also need to override the .add and .add_many methods to pass in the new record object.

is there reason not to pass in the data ?

# def add / add_many
    ...
    _id = str(self._id_generator(data))
@ybenitezf
Copy link

I have some data in json format that I'd like to migrate to pysonDB. However, I don't want to migrate the ids that I've already created.

Is there a way to create custom ids based on the record data? This would be a stopper for me because I don't want to have to change the ids that I've already created.

@Josverl
Copy link
Author

Josverl commented Jun 29, 2024

The only option I found is to do monkey patching the functions above, or fork and make those mods yourself

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

No branches or pull requests

2 participants