Skip to content

Commit

Permalink
Add docstrings to the function definitions in get_entities.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
rsh7 committed Aug 5, 2018
1 parent 5c64ffa commit 4532eb1
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions webserver/external/get_entities.py
Expand Up @@ -6,6 +6,16 @@


def get_original_entity(mbids):
"""Get original entity information after applying MBID redirect
to many mbids.
Args:
mbids (list): list of uuid (MBID(gid)) of the recordings.
Returns:
Dictionary containing the redirected original entity ids with MBIDs as keys.
- mbid: Recording mbids of the entities
- id: Original redirected ids of the entities after mbid redirect
"""
with mb_session() as db:
query = db.query(Recording)

Expand All @@ -24,6 +34,14 @@ def get_original_entity(mbids):


def get_mbids_from_gid_redirect_tables():
"""Fetch mbids from recording gid redirect table and calls function
get_original_entity to get the redirected result.
Returns:
Dictionary containing the redirected original entity ids with MBIDs as keys.
- mbid: Recording mbids of the entities
- id: Original redirected ids of the entities after mbid redirect
"""
with db.engine.begin() as connection:
query = text("""
SELECT gid
Expand Down

0 comments on commit 4532eb1

Please sign in to comment.