-
Notifications
You must be signed in to change notification settings - Fork 159
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
fix: Fill vfolder user and group field #1837
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
def _get_field(name: str) -> Any: | ||
try: | ||
return row[name] | ||
except sa.exc.NoSuchColumnError: | ||
return None | ||
|
||
return cls( | ||
id=row["id"], | ||
host=row["host"], | ||
quota_scope_id=row["quota_scope_id"], | ||
name=row["name"], | ||
user=row["user"], | ||
user_email=row["users_email"] if "users_email" in row else None, | ||
user_email=_get_field("users_email"), | ||
group=row["group"], | ||
group_name=row["groups_name"] if "groups_name" in row else None, | ||
group_name=_get_field("groups_name"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this for now, but please consider revamping whole column lookup logic as guarding NoSuchColumnError
like here may confuse future maintainers when they accidentally failed to include column to their SELECT query.
Co-authored-by: Kyujin Cho <[email protected]> Backported-from: main Backported-to: 23.09
Co-authored-by: Kyujin Cho <[email protected]>
Checklist: (if applicable)
ai.backend.test
docs
directory