Transfer

CSVInput

Create Manager

from terrene.transfer import CSVInputManager

manager = CSVInputManager(credentials=credentials, workspace=workspace)

Create

with open('/path/to/file.csv', 'r') as input_file:
    model = manager.create(
        name="my file", description="training dataset",
        file=input_file)

Get

model = mananger.get('uuid')

Query

query_params = {
    'workspace__object_id': '',
    'name': '',
    'description': '',
    'workspace__name': '',
    'workspace__owners__object_id': '',
    'workspace__owners__email': '',
    'workspace__contributors__object_id': '',
    'workspace__contributors__email': ''
}
models = manger.query(query_params)

Update

model.name = 'new name'
model.save()

WarehouseQueryInput

Create Manager

from terrene.transfer import WarehouseQueryInputManager

manager = WarehouseQueryInputManager(credentials=credentials, workspace=workspace)

Create

model = manager.create(
    name="my query", description="training dataset",
    query="FROM users SELECT *;", store=store)
model = manager.create(
    name="my query", description="training dataset",
    table="users", store=store)

To learn more about how to query data from your warehouse, please view the documentation on the store module.

Get

model = mananger.get('uuid')

Query

query_params = {
    'workspace__object_id': '',
    'name': '',
    'description': '',
    'workspace__name': '',
    'workspace__owners__object_id': '',
    'workspace__owners__email': '',
    'workspace__contributors__object_id': '',
    'workspace__contributors__email': ''
}
models = manger.query(query_params)

Update

model.name = 'new name'
model.save()