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
Discussion on design of the DbUser
model: no UUID and email is unique but mutable
#6174
Comments
tagging @mbercx |
Yeah, also just thought about this one and wanted to make the same comment.
Indeed, as you know I'm in favor of this. Another use case is that users do change email from time to time, e.g. when they move from EPFL to PSI. ^^
Can we not have the
This doesn't seem like a big problem to me. We definitely don't want to duplicate the nodes, and after all these operations the nodes are "owned" by the latest update of the user, so that seems fine? So, in my view:
|
We could, but this is a bad idea, because then you are hard-coupling the ORM to the configuration code. For other use cases that are similar, we have the Maybe we should prevent changing the user email directly through a |
Had another quick thought about this and found another disadvantage. The main idea for even having a |
The
DbUser
does not define a UUID column, unlike (almost?) all other database models. Rather, it more or less uses theemail
column for this purpose by making it unique. The email is used as a proxy of a real identifier for instances ofDbUser
(andUser
in the front-end ORM). For example, the default user of a profile is indicated by its email in the configuration file. Currently if the email of a user is changed (which is perfectly possible, even through theUser
ORM class), the profile no longer has a default user, if that user was the default one. Since AiiDA requires a default user to be set when creating any database entities, the code will start to except.There are also some problems to anticipate with archive imports I think. Currently the code explicitly checks for users that exist both in the profile and the archive, and only users with emails that don't yet exist in the profile are added. However, there are some weird edge cases. Consider the following.
In an existing profile:
a@email
a@email
user)b@email
The import code will notice that the node already exists and skips it. However, the code thinks that the user
a@email
doesn't exist yet (because it checks based onemail
) and it adds it. We know haveb@email
in the database which has a single node, anda@email
which has no nodes. Not sure yet whether this is a real problem.This could be fixed by adding UUIDs to users and simply use that, however, that would have downsides as well:
User
instance. From a user perspective, this is actually probably what is expected and desired. If we were to change this based on UUID, what is really the same user is now different in different profiles just because the UUID is different.Especially the last point is I think a strong argument to not add a UUID. The current behavior is actually what we want I think. We should maybe just consider whether to make the email immutable (at least through the front-end ORM). Not sure if there are good use-cases for it, and it could make behavior more complex with potential bugs.
One advantage that I could see now for keeping the email mutable is that we could even make the
--email
option in the profile setup completely optional by providing some default. This will make setting up a profile easier and if the user is actually interested in the generated data later and wants to export it with a "real" email, they can update the email.The text was updated successfully, but these errors were encountered: