Using scopes with qDrive
Scopes are entities that hold a number of datasets, usually related to a certain project. In Python, we offer some basic functionality to work with scopes.
Viewing Available Scopes
To see the scopes that are available to you, use the following commands:
from qdrive.scopes import get_scopes
print(scopes)
scopes = get_scopes()
print(scopes)
# Accessing the scopes
first_scope = scopes[0] # Get the first scope object in the list
print(first_scope.uuid) # Get the UUID of the first scope
print(first_scope.name) # Get the name of the first scope
Setting and Getting the Default Scope
When performing operations like searching or creating datasets, the package assumes a default scope is set. This default scope can be set or read using the following commands:
from qdrive.scopes import get_scopes, set_default_scope, get_default_scope
scopes = get_scopes()
# Print the name of the default scope that is currently set
print(get_default_scope().name)
# Set the default scope by name (option 1)
set_default_scope(scopes[0].name)
# Set the default scope by using the scope object (option 2)
set_default_scope(scopes[0])
Setting the Default Scope in the GUI
The default scope can also be set in the GUI. To do this, run the following commands:
from qdrive import launch_GUI
launch_GUI()
Then, set the selected scope property in the GUI.