def update(self, type_, allow_unsafe_updates=False):
    '\n        Update a product. Unsafe changes will throw a ValueError by default.\n\n        (An unsafe change is anything that may potentially make the product\n        incompatible with existing datasets of that type)\n\n        :param datacube.model.DatasetType type_: Product to add\n        :param allow_unsafe_updates bool: Allow unsafe changes. Use with caution.\n        :rtype: datacube.model.DatasetType\n        '
    DatasetType.validate(type_.definition)
    existing = self._db.get_dataset_type_by_name(type_.name)
    if (not existing):
        raise ValueError(('Unknown product %s, cannot update – did you intend to add it?' % type_.name))

    def handle_unsafe(msg):
        if (not allow_unsafe_updates):
            raise ValueError(msg)
        else:
            _LOG.warning('Ignoring %s', msg)
    safe_keys_to_change = ('description', 'metadata')
    doc_changes = get_doc_changes(existing.definition, jsonify_document(type_.definition))
    for (offset, old_value, new_value) in doc_changes:
        _LOG.info('Changing %s %s: %r -> %r', type_.name, '.'.join(offset), old_value, new_value)
        key_name = offset[0]
        if (key_name not in safe_keys_to_change):
            handle_unsafe(('Potentially unsafe update: changing %r of product definition.' % key_name))
        if (key_name == 'metadata'):
            if (not contains(old_value, new_value, case_sensitive=True)):
                handle_unsafe('Unsafe update: new product match rules are not a superset of old ones.')
    if doc_changes:
        _LOG.info('Updating product %s', type_.name)
        self._db.update_dataset_type(name=type_.name, metadata=type_.metadata_doc, metadata_type_id=type_.metadata_type.id, definition=type_.definition)
        self.get_by_name.cache_clear()
        self.get.cache_clear()
    else:
        _LOG.info('No changes detected for product %s', type_.name)
Update a product. Unsafe changes will throw a ValueError by default.

(An unsafe change is anything that may potentially make the product
incompatible with existing datasets of that type)

:param datacube.model.DatasetType type_: Product to add
:param allow_unsafe_updates bool: Allow unsafe changes. Use with caution.
:rtype: datacube.model.DatasetType
def update(self, type_, allow_unsafe_updates=False):
    '\n        Update a product. Unsafe changes will throw a ValueError by default.\n\n        (An unsafe change is anything that may potentially make the product\n        incompatible with existing datasets of that type)\n\n        :param datacube.model.DatasetType type_: Product to add\n        :param allow_unsafe_updates bool: Allow unsafe changes. Use with caution.\n        :rtype: datacube.model.DatasetType\n        '
    DatasetType.validate(type_.definition)
    existing = self._db.get_dataset_type_by_name(type_.name)
    if (not existing):
        raise ValueError(('Unknown product %s, cannot update – did you intend to add it?' % type_.name))

    def handle_unsafe(msg):
        if (not allow_unsafe_updates):
            raise ValueError(msg)
        else:
            _LOG.warning('Ignoring %s', msg)
    safe_keys_to_change = ('description', 'metadata')
    doc_changes = get_doc_changes(existing.definition, jsonify_document(type_.definition))
    for (offset, old_value, new_value) in doc_changes:
        _LOG.info('Changing %s %s: %r -> %r', type_.name, '.'.join(offset), old_value, new_value)
        key_name = offset[0]
        if (key_name not in safe_keys_to_change):
            handle_unsafe(('Potentially unsafe update: changing %r of product definition.' % key_name))
        if (key_name == 'metadata'):
            if (not contains(old_value, new_value, case_sensitive=True)):
                handle_unsafe('Unsafe update: new product match rules are not a superset of old ones.')
    if doc_changes:
        _LOG.info('Updating product %s', type_.name)
        self._db.update_dataset_type(name=type_.name, metadata=type_.metadata_doc, metadata_type_id=type_.metadata_type.id, definition=type_.definition)
        self.get_by_name.cache_clear()
        self.get.cache_clear()
    else:
        _LOG.info('No changes detected for product %s', type_.name)