Skip to main content
Version: v2.1.0

Admin Transfer Ownership Example

from featurestore import Client
from featurestore.core.access_type import AccessType
from grpc import RpcError

# Initialise feature store client using a user that has admin access
client = Client("ip:port")
client.auth.login()

# Old and new email to transfer the user's projects
old_email = "old@example.com"
new_email = "new@example.com"

# Find all the projects the user is the owner of.
owner_projects = list(client.projects.admin.list(user_email=old_email, required_permission=AccessType.OWNER))

# Remove the old owner and add the new owner.
for project in owner_projects:
try:
project.add_owners([new_email])
except RpcError as error:
if "is already 'OWNER'" in error.details():
print(f"{new_email} is already OWNER")
project.remove_owners([old_email])
print(f"Transferred ownership from {old_email} to {new_email} for project {project.name}")

Feedback