datacatalog.linkedstores.experiment_design.mappings.gdrive package¶
Submodules¶
datacatalog.linkedstores.experiment_design.mappings.gdrive.build_list module¶
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors module¶
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.ExperimentReferenceError[source]¶ Bases:
Exception
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.GoogleSheetsError[source]¶ Bases:
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.ExperimentReferenceError
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.IncorrectConfiguration[source]¶ Bases:
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.ExperimentReferenceError
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.LookupNotPopulated[source]¶ Bases:
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.ExperimentReferenceError
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.MappingNotFound[source]¶ Bases:
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.ExperimentReferenceError
-
exception
datacatalog.linkedstores.experiment_design.mappings.gdrive.errors.UnsupportedMapping[source]¶ Bases:
NotImplementedError
datacatalog.linkedstores.experiment_design.mappings.gdrive.gdrive module¶
-
class
datacatalog.linkedstores.experiment_design.mappings.gdrive.gdrive.ExperimentReferenceMapping(mapper_config, google_client=None, google_client_path=None)[source]¶ Bases:
objectSynchronizable mapping between ExperimentDesign and a Google Document
-
__init__(mapper_config, google_client=None, google_client_path=None)[source]¶ Initialize connection to Google Drive API
Parameters: Raises: IncorrectConfiguration– Raised when mapper_config is incorrect
-
config= None¶ Value passed for mapping_config
-
encode_files(files_listing)[source]¶ Transform a Google Drive listing into ExperimentDesigns
Parameters: files_listing (list) – a listing from Google files API v3 Returns: List of ExperimentDesign dict objects Return type: list
-
encode_title_as_id(textstring, stopwords=[], separator='-')[source]¶ Transform Google Document title into an identifier
Parameters: Returns: The slugified version of textstring
Return type:
-
failures= None¶ Cache of failed Google Drive API query responses
-
filescache= None¶ Cached lookups from Google Drive API queries
-
id_to_key(id, keyname)[source]¶ Get the value for a key associated with a given identifier
Parameters: Raises: UnsupportedMapping– Occurs when keyname does not exist in the documentMappingNotFound– Occurs when id is not known
Returns: The value of keyname in the ExperimentMapping identifier by id
Return type:
-
populate()[source]¶ Populate the mapping cache
This must be done explicitly after __init__` to avoid thrashing the API client.
Raises: GoogleSheetsError– Occurs if connection or query to Google failsReturns: Returns self so that populate can be chained to another service call Return type: object
-
ready= None¶ Semaphore marking the Google Drive API client as ready
-
token= None¶ Google API client
-
tokenpath= None¶ Path to API credentials file
-
uri_to_key(uri, keyname)[source]¶ Get the value for a key associated with a reference URI
Parameters: Raises: UnsupportedMapping– Occurs when uri is not a valid URI or keyname does not exist in documentMappingNotFound– Occurs when mapping is not successful
Returns: The value of keyname in the ExperimentMapping identifier by uri
Return type:
-