Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions samples/query_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,41 @@
print('execute_sql did not timeout')
except Timeout:
print('Caught Timeout')


###################
# Test QC State Definitions
###################

# Create new QC state definitions
qcstates = [{
'label': 'needs verification',
'description': 'please look at this',
'publicData': False
}, {
'label': 'approved',
'publicData': True
}]
result = insert_rows(server_context, 'core', 'qcstate', qcstates)
for row in result['rows']:
print('Created QC state: ' + row['label'])

result = select_rows(server_context, "core", "qcstate")

# Update a QC state definitions
originalValue = result['rows'][1]
testRow = {
'RowId': originalValue['RowId'],
'label': 'Updated Label'
}
updateResult = update_rows(server_context, "core", "qcstate", [testRow])
print('Updated label: approved -> ' + updateResult['rows'][0]['label'])

# Delete all unused QC state definitions
result = select_rows(server_context, 'core', 'qcstate')
for row in result['rows']:
print('Deleting QC state: ' + row['Label'])
try:
delete_rows(server_context, 'core', 'qcstate', [row])
except ServerContextError as sce:
print(sce)