table_advanced_samples_4.py 958 B

123456789101112131415161718
  1. def set_service_properties(self, table_service):
  2. print('1. Get Table service properties')
  3. props = table_service.get_table_service_properties()
  4. retention = RetentionPolicy(enabled=True, days=5)
  5. logging = Logging(delete=True, read=False, write=True, retention_policy=retention)
  6. hour_metrics = Metrics(enabled=True, include_apis=True, retention_policy=retention)
  7. minute_metrics = Metrics(enabled=False)
  8. try:
  9. print('2. Ovewrite Table service properties')
  10. table_service.set_table_service_properties(logging=logging, hour_metrics=hour_metrics, minute_metrics=minute_metrics)
  11. finally:
  12. print('3. Revert Table service properties back to the original ones')
  13. table_service.set_table_service_properties(logging=props.logging, hour_metrics=props.hour_metrics, minute_metrics=props.minute_metrics)
  14. print('4. Set Table service properties completed')