Managing projects

Basic operations

The list of projects in the DSS instance can be retrieved with the list_project_keys method.

client = DSSClient(host, apiKey)
dss_projects = client.list_project_keys()
print(dss_projects)

outputs

['IMPALA', 'MYSQL', 'PARTITIONED', 'PLUGINS']

Projects can be added:

new_project = client.create_project('TEST_PROJECT', 'test project', 'tester', description='a simple description')
print(client.list_project_keys()

outputs

['IMPALA', 'MYSQL', 'PARTITIONED', 'PLUGINS', 'TEST_PROJECT']

Two parts of the project’s settings can be modified directly: the metadata and the permissions. In both cases, it is advised to first retrieve the current settings state with the get_metadata and get_permissions call, modify the returned object, and then set it back on the DSS instance.

project_metadata = new_project.get_metadata()
project_metadata['tag'] = ['tag1','tag2']
new_project.set_metadata(project_metadata)

project_permissions = new_project.get_permissions()
project_permissions['permissions'].append({'group':'data_scientists','type':'ANALYST_READONLY'})
new_project.set_permissions(project_permissions)

Projects can also be deleted:

project = client.get_project('TEST_PROJECT')
project.delete()

Exporting

Project export is available through the python API in two forms: either as a stream, or exported directly to a file. The data is sent zipped.

project = client.get_project('TEST_PROJECT')

project.export_to_file('exported_project.zip')

with project.get_export_stream() as s:
        ...