isogeo_migrations_toolbelt.duplicate.duplicator module¶
-
class
isogeo_migrations_toolbelt.duplicate.duplicator.
MetadataDuplicator
(api_client: isogeo_pysdk.isogeo.Isogeo, source_metadata_uuid: uuid.UUID)[source]¶ Bases:
object
Duplicate metadata. Most used for development purposes.
Parameters: - api_client (Isogeo) – already authenticated Isogeo client to use to performe API operations
- source_metadata_uuid (UUID) – UUID of the metadata to be duplicated (source)
-
duplicate_into_other_group
(destination_workgroup_uuid: str, copymark_catalog: str = None, copymark_title: bool = True, copymark_abstract: bool = True, exclude_catalogs: list = [], exclude_subresources: list = []) → isogeo_pysdk.models.metadata.Metadata[source]¶ Create an exact copy of the metadata source into another workgroup. It can apply some copy marks to distinguish the copy from the original.
Parameters: - copymark_catalog (str) – add the new metadata to this additionnal catalog. Defaults to None
- copymark_title (bool) – add a [COPY] mark at the end of the new metadata (default: {True}). Defaults to True
- copymark_abstract (bool) – add a [Copied from](./source_uuid)] mark at the end of the new metadata abstract. Defaults to True
- exclude_catalogs (list) – list of catalogs UUID’s to not associate to destination metadata
:param list exclude_subresources : list of subressources to be excluded. Must be metadata attributes names
Returns: the newly created Metadata Return type: Metadata Example: # instanciate the metadata duplicator md_source = MetadataDuplicator( isogeo=isogeo, source_metadata_uuid=environ.get("ISOGEO_METADATA_FIXTURE_UUID") ) # duplicate it new_md = md_source.duplicate_into_same_group()
-
duplicate_into_same_group
(copymark_catalog: str = None, copymark_title: bool = True, copymark_abstract: bool = True, exclude_catalogs: list = [], switch_service_layers: bool = False) → isogeo_pysdk.models.metadata.Metadata[source]¶ Create an exact copy of the metadata source in the same workgroup. It can apply some copy marks to distinguish the copy from the original.
Parameters: - copymark_catalog (str) – add the new metadata to this additionnal catalog. Defaults to None
- copymark_title (bool) – add a [COPY] mark at the end of the new metadata (default: {True}). Defaults to True
- copymark_abstract (bool) – add a [Copied from](./source_uuid)] mark at the end of the new metadata abstract. Defaults to True
- exclude_catalogs (list) – list of catalogs UUID’s to not associate to destination metadata
- switch_service_layers (bool) – a service layer can’t be associated to many datasetes. If this option is enabled, service layers are removed from the metadata source then added to the new one. Defaults to False
Returns: the newly created Metadata
Return type: Metadata
# instanciate the metadata duplicator md_source = MetadataDuplicator( isogeo=isogeo, source_metadata_uuid=environ.get("ISOGEO_METADATA_FIXTURE_UUID") ) # duplicate it new_md = md_source.duplicate_into_same_group()
-
import_into_other_metadata
(destination_metadata_uuid: str, copymark_catalog: str = None, copymark_title: bool = True, copymark_abstract: bool = True, exclude_catalogs: list = [], switch_service_layers: bool = False, exclude_fields: list = ['coordinateSystem', 'envelope', 'features', 'geometry', 'name', 'path'], exclude_subresources: list = []) → isogeo_pysdk.models.metadata.Metadata[source]¶ Import a metadata content into another one. It can exclude some fields. It can apply some copy marks to distinguish the copy from the original.
Parameters: - destination_metadata_uuid (str) – UUID of the metadata to update with source metadata
- exclude_fields (list) – list of fields to be excluded. Must be attributes names
:param list exclude_subresources : list of subressources to be excluded. Must be metadata attributes names :param str copymark_catalog: add the new metadata to this additionnal catalog. Defaults to None :param bool copymark_title: add a [COPY] mark at the end of the new metadata (default: {True}). Defaults to True :param bool copymark_abstract: add a [Copied from](./source_uuid)] mark at the end of the new metadata abstract. Defaults to True :param list exclude_catalogs: list of catalogs UUID’s to not associate to destination metadata :param bool switch_service_layers: a service layer can’t be associated to many datasetes. If this option is enabled, service layers are removed from the metadata source then added to the new one. Defaults to False
Returns: the updated Metadata Return type: Metadata # TO DO