Created
July 31, 2018 19:43
-
-
Save pcattori/4e5b4987c6a028ee77307867f1e1eafa to your computer and use it in GitHub Desktop.
`builder-first` python implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unifyapi.v1 as api | |
unify = api.Client() | |
# get all datasets by name | |
matching_datasets = [d for d in unify.datasets.get() if d.name == 'myDataset'] # client convenience method: unify.datasets.find_by_name(...) | |
assert(len(matching_datasets) == 1) | |
dataset = matching_datasets[0] | |
# 1. Update Dataset records | |
dataset.update_records(updates) | |
# Get all projects and find by name | |
matching_projects = [p for p in unify.projects.get()] # client convenience method: unify.projects.find_by_name(...) | |
assert(len(matching_projects) == 1) | |
project = matching_projects[0] | |
# 2. Update the Unified Dataset | |
ud_operation = project.unifiedDataset.refresh() | |
# 3. Wait for operation to complete | |
ud_operation.wait() | |
# 4. Refresh the model. | |
model_operation = project.categorizations.model.refresh() | |
# 5. Wait for operation to complete | |
model_oeration.wait() | |
# 6. Refresh the categorizations | |
cat_operation = project.categorizations.refresh() | |
# 7. Wait for operation to complete | |
cat_operation.wait() | |
# 8. Refresh export dataset | |
dataset_operation = dataset.refresh() | |
# 9. Wait for operation to complete | |
dataset_operation.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment