Skip to content

Instantly share code, notes, and snippets.

@kartikeyaSh
Last active March 21, 2018 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kartikeyaSh/25646d4b89bfb999a75cb632c6d1d403 to your computer and use it in GitHub Desktop.
Save kartikeyaSh/25646d4b89bfb999a75cb632c6d1d403 to your computer and use it in GitHub Desktop.

Let's create clusters where 'recording_mbid' ='58e48a5d-0ce7-49b8-b1f9-b96a56892eec'

  1. Get IDs from recording_json for 'recording_mbid' ='58e48a5d-0ce7-49b8-b1f9-b96a56892eec'. SELECT * FROM recording_json WHERE data ->> 'recording_mbid' ='58e48a5d-0ce7-49b8-b1f9-b96a56892eec';
id data data_sha256 meta_sha256
1054240 {"artist":"The Oh Hellos","recording_mbid":"58e48a5d-0ce7-49b8-b1f9-b96a56892eec","release":"The Oh Hellos EP","title":"Cold Is the Night"} d8134f6e80c8d841ceb229024942b73154668ea0da20d83eeebf1bd29d0d01bb 550185d5dc2b9a269db15e2c94fffa22b0ab4cea89023770358a8b310ac58ca5
1107275 {"artist":"The Oh Hellos","recording_mbid":"58e48a5d-0ce7-49b8-b1f9-b96a56892eec","release":"The Oh Hello's","title":"Cold Is the Night"} 2cdea46c3446d0cca1732df5bce12cec3305b94b6c7bdcff9af87f376fbbd84b 550185d5dc2b9a269db15e2c94fffa22b0ab4cea89023770358a8b310ac58ca5
5864854 {"artist":"The Oh Hellos","recording_mbid":"58e48a5d-0ce7-49b8-b1f9-b96a56892eec","title":"Cold Is the Night"} ebbce841db049579f6350c5e8cc665439e9bb7a16bf7ecb8a50b0bc1cc8abaaa
8772454 {"artist":"The Oh Hellos","recording_mbid":"58e48a5d-0ce7-49b8-b1f9-b96a56892eec","release":"The Summer Kollection","title":"Cold Is the Night"} 33cf15c39be9368094480a3483923b759422f3bf0e551c475efed80bf42af98a 550185d5dc2b9a269db15e2c94fffa22b0ab4cea89023770358a8b310ac58ca5
  1. Get gids from recording.

SELECT gid FROM recording WHERE data = 8772454 OR data = 1054240 OR data = 1107275 OR data = 5864854;

gid
f9c89d8b-b6d8-4996-83fa-8a9444962b98
28aae0dd-6f0a-49da-92a0-1ddddcf0ea90
1e30ac1b-6d1a-4e0d-bd12-4177eb7d9ecb
8ec1db13-aa0c-4a52-9885-2ffcd031534d
  1. Increment cluster id and add to recording_cluster table.
cluster id recording_gid
1 f9c89d8b-b6d8-4996-83fa-8a9444962b98
1 28aae0dd-6f0a-49da-92a0-1ddddcf0ea90
1 1e30ac1b-6d1a-4e0d-bd12-4177eb7d9ecb
1 8ec1db13-aa0c-4a52-9885-2ffcd031534d
  1. Add cluster id and MBID to recording_redirect table.
recording_cluster_id recording_mbid
1 58e48a5d-0ce7-49b8-b1f9-b96a56892eec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment