{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "c8a296f6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-18T13:21:25.455475Z",
     "start_time": "2024-05-18T13:21:25.312843Z"
    }
   },
   "outputs": [],
   "source": [
    "!sudo tailscale up --accept-routes=true"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "63f61ed2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-18T13:21:26.858487Z",
     "start_time": "2024-05-18T13:21:26.253210Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_1586536/2186673705.py:1: DeprecationWarning: \n",
      "Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0),\n",
      "(to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries)\n",
      "but was not found to be installed on your system.\n",
      "If this would cause problems for you,\n",
      "please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466\n",
      "        \n",
      "  import pandas as pd\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import sqlalchemy\n",
    "from suno_utils.audio import Audio\n",
    "from suno_utils.utils.s3 import open_from_s3\n",
    "import numpy as np\n",
    "import ast\n",
    "import tqdm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "eb8470b7",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-18T13:21:27.334404Z",
     "start_time": "2024-05-18T13:21:27.297283Z"
    }
   },
   "outputs": [],
   "source": [
    "engine = sqlalchemy.create_engine(\n",
    "    \"postgresql://postgres:GU$_U.<iUZrs-vr<0MJq..+QttqB@suno-main-pgdb-prod-analytics.cnfvffydbwvc.us-east-2.rds.amazonaws.com/suno_main\"\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "490bc847",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-18T13:21:28.108764Z",
     "start_time": "2024-05-18T13:21:27.477198Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['bots_creditpack' 'bots_modeltype' 'bots_promptinspiration'\n",
      " 'configs_sample' 'configs_switch' 'django_migrations' 'django_session'\n",
      " 'waffle_sample' 'waffle_switch' 'auth_permission'\n",
      " 'auth_group_permissions' 'auth_group' 'django_content_type'\n",
      " 'auth_user_groups' 'auth_user' 'auth_user_user_permissions'\n",
      " 'bots_actionlogging' 'bots_generatedclip' 'bots_clipdiscordmessage'\n",
      " 'bots_clipprompt' 'bots_usageplan' 'bots_discordinfo' 'bots_dailytheme'\n",
      " 'bots_generationrequest' 'bots_generatedclipextra'\n",
      " 'bots_generatedplaylistoverride' 'bots_generatedplaylist' 'bots_playlist'\n",
      " 'bots_periodcreditusage' 'bots_playlistclip' 'bots_profilefollow'\n",
      " 'bots_purchaseinfo' 'bots_userplaylistreaction' 'bots_userreaction'\n",
      " 'clips_clip' 'clips_clip_playlists' 'clips_playlist' 'clips_clip_tags'\n",
      " 'clips_tag' 'clips_team' 'clips_teammembership' 'clips_textprompt'\n",
      " 'clips_textprompt_tags' 'clips_usercliprating' 'clips_usertoken'\n",
      " 'configs_flag' 'configs_flag_groups' 'configs_flag_users'\n",
      " 'django_admin_log' 'waffle_flag' 'waffle_flag_groups' 'waffle_flag_users'\n",
      " 'pg_stat_statements_info' 'pg_stat_statements' 'bots_userstats']\n"
     ]
    }
   ],
   "source": [
    "df_all_tables = pd.read_sql_query(\n",
    "    \"SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'\",\n",
    "    engine,\n",
    ")\n",
    "print(df_all_tables[\"table_name\"].values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "991a8b2a",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T18:14:58.516797Z",
     "start_time": "2024-05-16T18:14:54.218603Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>created_at</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>time_used</th>\n",
       "      <th>metadata</th>\n",
       "      <th>user_id</th>\n",
       "      <th>status</th>\n",
       "      <th>discord_message_id</th>\n",
       "      <th>prompt_id</th>\n",
       "      <th>request_id</th>\n",
       "      <th>...</th>\n",
       "      <th>daily_theme_id</th>\n",
       "      <th>is_deleted</th>\n",
       "      <th>image_s3_id</th>\n",
       "      <th>is_public</th>\n",
       "      <th>dislike_count</th>\n",
       "      <th>flag_count</th>\n",
       "      <th>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>title</th>\n",
       "      <th>slug</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>36548</th>\n",
       "      <td>64f859be-6179-44e0-9cd8-e00b2f19df40</td>\n",
       "      <td>2024-05-16 18:14:54.159260+00:00</td>\n",
       "      <td>2024-05-16 18:14:54.159266+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'Reggae', 'type': 'gen', 'prompt': 'E...</td>\n",
       "      <td>11174853</td>\n",
       "      <td>submitted</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>4af582ea-8008-4f11-b096-2079c135c9fa</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Fumando nutos en el Antonios</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36549</th>\n",
       "      <td>e198b9b4-da76-4a87-b44c-4e30ae91685a</td>\n",
       "      <td>2024-05-16 18:14:54.174144+00:00</td>\n",
       "      <td>2024-05-16 18:14:54.174161+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': None, 'type': 'gen', 'prompt': '', 's...</td>\n",
       "      <td>19779493</td>\n",
       "      <td>submitted</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>1cc81c13-ea27-41a2-a081-ff00d13a5455</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36550</th>\n",
       "      <td>5c90fd75-2db9-4c05-94c4-b2eaaedc615d</td>\n",
       "      <td>2024-05-16 18:14:54.174271+00:00</td>\n",
       "      <td>2024-05-16 18:14:54.174281+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': None, 'type': 'gen', 'prompt': '', 's...</td>\n",
       "      <td>19779493</td>\n",
       "      <td>submitted</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>1cc81c13-ea27-41a2-a081-ff00d13a5455</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36551</th>\n",
       "      <td>74a3563b-0058-4420-aaa2-0d9f3a42c35c</td>\n",
       "      <td>2024-05-16 18:14:54.178234+00:00</td>\n",
       "      <td>2024-05-16 18:14:54.178245+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'Pop Rock', 'type': 'gen', 'prompt': ...</td>\n",
       "      <td>12825134</td>\n",
       "      <td>submitted</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>b31b0e49-4147-406f-bb7d-888bfe3be0fb</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Звон 2</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36552</th>\n",
       "      <td>c5262b8e-f2ea-42da-8df6-3967fa579c4d</td>\n",
       "      <td>2024-05-16 18:14:54.178318+00:00</td>\n",
       "      <td>2024-05-16 18:14:54.178323+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'Pop Rock', 'type': 'gen', 'prompt': ...</td>\n",
       "      <td>12825134</td>\n",
       "      <td>submitted</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>b31b0e49-4147-406f-bb7d-888bfe3be0fb</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>Звон 2</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                         id                       created_at  \\\n",
       "36548  64f859be-6179-44e0-9cd8-e00b2f19df40 2024-05-16 18:14:54.159260+00:00   \n",
       "36549  e198b9b4-da76-4a87-b44c-4e30ae91685a 2024-05-16 18:14:54.174144+00:00   \n",
       "36550  5c90fd75-2db9-4c05-94c4-b2eaaedc615d 2024-05-16 18:14:54.174271+00:00   \n",
       "36551  74a3563b-0058-4420-aaa2-0d9f3a42c35c 2024-05-16 18:14:54.178234+00:00   \n",
       "36552  c5262b8e-f2ea-42da-8df6-3967fa579c4d 2024-05-16 18:14:54.178318+00:00   \n",
       "\n",
       "                            updated_at  time_used  \\\n",
       "36548 2024-05-16 18:14:54.159266+00:00        0.0   \n",
       "36549 2024-05-16 18:14:54.174161+00:00        0.0   \n",
       "36550 2024-05-16 18:14:54.174281+00:00        0.0   \n",
       "36551 2024-05-16 18:14:54.178245+00:00        0.0   \n",
       "36552 2024-05-16 18:14:54.178323+00:00        0.0   \n",
       "\n",
       "                                                metadata   user_id     status  \\\n",
       "36548  {'tags': 'Reggae', 'type': 'gen', 'prompt': 'E...  11174853  submitted   \n",
       "36549  {'tags': None, 'type': 'gen', 'prompt': '', 's...  19779493  submitted   \n",
       "36550  {'tags': None, 'type': 'gen', 'prompt': '', 's...  19779493  submitted   \n",
       "36551  {'tags': 'Pop Rock', 'type': 'gen', 'prompt': ...  12825134  submitted   \n",
       "36552  {'tags': 'Pop Rock', 'type': 'gen', 'prompt': ...  12825134  submitted   \n",
       "\n",
       "      discord_message_id prompt_id                            request_id  ...  \\\n",
       "36548               None      None  4af582ea-8008-4f11-b096-2079c135c9fa  ...   \n",
       "36549               None      None  1cc81c13-ea27-41a2-a081-ff00d13a5455  ...   \n",
       "36550               None      None  1cc81c13-ea27-41a2-a081-ff00d13a5455  ...   \n",
       "36551               None      None  b31b0e49-4147-406f-bb7d-888bfe3be0fb  ...   \n",
       "36552               None      None  b31b0e49-4147-406f-bb7d-888bfe3be0fb  ...   \n",
       "\n",
       "       daily_theme_id is_deleted  image_s3_id  is_public dislike_count  \\\n",
       "36548            None      False         None      False             0   \n",
       "36549            None      False         None      False             0   \n",
       "36550            None      False         None      False             0   \n",
       "36551            None      False         None      False             0   \n",
       "36552            None      False         None      False             0   \n",
       "\n",
       "      flag_count play_count  skip_count                         title  slug  \n",
       "36548          0          0           0  Fumando nutos en el Antonios  None  \n",
       "36549          0          0           0                                None  \n",
       "36550          0          0           0                                None  \n",
       "36551          0          0           0                        Звон 2  None  \n",
       "36552          0          0           0                        Звон 2  None  \n",
       "\n",
       "[5 rows x 26 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where created_at>='2024-05-16 18:05:05';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_clip.tail()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "4c1835e2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T18:15:16.808959Z",
     "start_time": "2024-05-16T18:15:16.797926Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Series([], Name: title, dtype: object)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip[df_clip[\"title\"].str.contains(\"岁月\")]['title']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "c2668c68",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-18T13:23:00.210070Z",
     "start_time": "2024-05-18T13:23:00.105882Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'tags': 'anthemic rock', 'type': 'gen', 'prompt': \"[Verse]\\nHarry's the name\\nZamboni's the game\\nDriving 'round the ice\\nAin't got time for fame\\nSmoothin' out the surface\\nMakin' it shine\\nZamboni ridin'\\nYeah\\nHarry's doin' fine\\n\\n[Verse 2]\\nThrough the twists and the turns\\nHe's in control\\nHarry's on a mission\\nGot a story to unfold\\nFrom end to end\\nHe glides with grace\\nZamboni hero\\nNever misses a trace\\n\\n[Chorus]\\nBack to the garage\\nHarry rides tonight\\nZamboni driver\\nKeepin' the ice so right\\nBack to the garage\\nUnder the neon lights\\nHarry's on his way\\nBack to the garage tonight\", 'stream': True, 'duration': 120.0, 'priority': 0, 'experiment': ['chirp-v3-engine-s', 'chirp-v3-engine-i'], 'gpt_prompt': None, 'refund_credits': False, 'make_instrumental': False, 'gpt_description_prompt': 'A song about a Zamboni driver named Harry driving his Zamboni back to the garage '}\n",
      "model is chirp-v3-engine-s\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>created_at</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>time_used</th>\n",
       "      <th>metadata</th>\n",
       "      <th>user_id</th>\n",
       "      <th>status</th>\n",
       "      <th>discord_message_id</th>\n",
       "      <th>prompt_id</th>\n",
       "      <th>request_id</th>\n",
       "      <th>...</th>\n",
       "      <th>daily_theme_id</th>\n",
       "      <th>is_deleted</th>\n",
       "      <th>image_s3_id</th>\n",
       "      <th>is_public</th>\n",
       "      <th>dislike_count</th>\n",
       "      <th>flag_count</th>\n",
       "      <th>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>title</th>\n",
       "      <th>slug</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>bcdc1cb3-1c05-41d6-b91d-99000a5b482d</td>\n",
       "      <td>2024-05-18 11:32:58.388728+00:00</td>\n",
       "      <td>2024-05-18 11:32:58.388742+00:00</td>\n",
       "      <td>91.870147</td>\n",
       "      <td>{'tags': 'anthemic rock', 'type': 'gen', 'prom...</td>\n",
       "      <td>21</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>0b953aed-a444-4855-a989-9de62ed05fb1</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_bcdc1cb3-1c05-41d6-b91d-99000a5b482d</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>Back to the Garage</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at  \\\n",
       "0  bcdc1cb3-1c05-41d6-b91d-99000a5b482d 2024-05-18 11:32:58.388728+00:00   \n",
       "\n",
       "                        updated_at  time_used  \\\n",
       "0 2024-05-18 11:32:58.388742+00:00  91.870147   \n",
       "\n",
       "                                            metadata  user_id    status  \\\n",
       "0  {'tags': 'anthemic rock', 'type': 'gen', 'prom...       21  complete   \n",
       "\n",
       "  discord_message_id prompt_id                            request_id  ...  \\\n",
       "0               None      None  0b953aed-a444-4855-a989-9de62ed05fb1  ...   \n",
       "\n",
       "   daily_theme_id is_deleted                                 image_s3_id  \\\n",
       "0            None      False  image_bcdc1cb3-1c05-41d6-b91d-99000a5b482d   \n",
       "\n",
       "   is_public dislike_count flag_count play_count  skip_count  \\\n",
       "0      False             0          0          8           0   \n",
       "\n",
       "                title  slug  \n",
       "0  Back to the Garage  None  \n",
       "\n",
       "[1 rows x 26 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where id='bcdc1cb3-1c05-41d6-b91d-99000a5b482d';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "if df_clip.shape[0] > 0:\n",
    "    print(df_clip[\"metadata\"][0])\n",
    "    print(\"model is\", df_clip[\"model_name\"][0])\n",
    "df_clip.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "621ed7cb",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-05-16T18:18:46.944392Z",
     "start_time": "2024-05-16T18:18:46.828725Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>created_at</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>time_used</th>\n",
       "      <th>metadata</th>\n",
       "      <th>user_id</th>\n",
       "      <th>status</th>\n",
       "      <th>discord_message_id</th>\n",
       "      <th>prompt_id</th>\n",
       "      <th>request_id</th>\n",
       "      <th>...</th>\n",
       "      <th>daily_theme_id</th>\n",
       "      <th>is_deleted</th>\n",
       "      <th>image_s3_id</th>\n",
       "      <th>is_public</th>\n",
       "      <th>dislike_count</th>\n",
       "      <th>flag_count</th>\n",
       "      <th>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>title</th>\n",
       "      <th>slug</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>92b296ef-073d-429a-9daf-d0646244abde</td>\n",
       "      <td>2024-05-16 18:10:53.718262+00:00</td>\n",
       "      <td>2024-05-16 18:10:53.718269+00:00</td>\n",
       "      <td>86.714957</td>\n",
       "      <td>{'tags': 'Modern Classical  Music Box', 'type'...</td>\n",
       "      <td>16740387</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>242b4f02-59bd-451e-9cbe-87d26404ba96</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_92b296ef-073d-429a-9daf-d0646244abde</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>ea5256bc-3238-48b7-a07a-f8141b104752</td>\n",
       "      <td>2024-05-16 18:10:53.718173+00:00</td>\n",
       "      <td>2024-05-16 18:10:53.718186+00:00</td>\n",
       "      <td>83.347621</td>\n",
       "      <td>{'tags': 'Modern Classical  Music Box', 'type'...</td>\n",
       "      <td>16740387</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>242b4f02-59bd-451e-9cbe-87d26404ba96</td>\n",
       "      <td>...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_ea5256bc-3238-48b7-a07a-f8141b104752</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at  \\\n",
       "0  92b296ef-073d-429a-9daf-d0646244abde 2024-05-16 18:10:53.718262+00:00   \n",
       "1  ea5256bc-3238-48b7-a07a-f8141b104752 2024-05-16 18:10:53.718173+00:00   \n",
       "\n",
       "                        updated_at  time_used  \\\n",
       "0 2024-05-16 18:10:53.718269+00:00  86.714957   \n",
       "1 2024-05-16 18:10:53.718186+00:00  83.347621   \n",
       "\n",
       "                                            metadata   user_id    status  \\\n",
       "0  {'tags': 'Modern Classical  Music Box', 'type'...  16740387  complete   \n",
       "1  {'tags': 'Modern Classical  Music Box', 'type'...  16740387  complete   \n",
       "\n",
       "  discord_message_id prompt_id                            request_id  ...  \\\n",
       "0               None      None  242b4f02-59bd-451e-9cbe-87d26404ba96  ...   \n",
       "1               None      None  242b4f02-59bd-451e-9cbe-87d26404ba96  ...   \n",
       "\n",
       "   daily_theme_id is_deleted                                 image_s3_id  \\\n",
       "0            None      False  image_92b296ef-073d-429a-9daf-d0646244abde   \n",
       "1            None      False  image_ea5256bc-3238-48b7-a07a-f8141b104752   \n",
       "\n",
       "   is_public dislike_count flag_count play_count  skip_count title  slug  \n",
       "0      False             0          0          0           0        None  \n",
       "1      False             0          0          1           0        None  \n",
       "\n",
       "[2 rows x 26 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where request_id='242b4f02-59bd-451e-9cbe-87d26404ba96';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_clip.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "aaf44888",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-03-22T13:59:39.946798Z",
     "start_time": "2024-03-22T13:59:39.937634Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>created_at</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>time_used</th>\n",
       "      <th>metadata</th>\n",
       "      <th>user_id</th>\n",
       "      <th>status</th>\n",
       "      <th>discord_message_id</th>\n",
       "      <th>prompt_id</th>\n",
       "      <th>request_id</th>\n",
       "      <th>...</th>\n",
       "      <th>is_deleted</th>\n",
       "      <th>image_s3_id</th>\n",
       "      <th>is_public</th>\n",
       "      <th>dislike_count</th>\n",
       "      <th>flag_count</th>\n",
       "      <th>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>title</th>\n",
       "      <th>is_public_approved</th>\n",
       "      <th>slug</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>17d5fcc3-095e-468a-8719-bbdb40a72bd3</td>\n",
       "      <td>2024-03-20 01:02:45.374600+00:00</td>\n",
       "      <td>2024-03-20 01:02:45.374607+00:00</td>\n",
       "      <td>122.459554</td>\n",
       "      <td>{'tags': 'aggressive hammered dulcimer, buzuq,...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>9d7c6c06-4742-49a5-bc1d-ac6500b3bfc0</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_17d5fcc3-095e-468a-8719-bbdb40a72bd3</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>a6e4dcb7-dcd0-4890-aa10-93af6645e2c1</td>\n",
       "      <td>2024-03-20 01:02:45.374481+00:00</td>\n",
       "      <td>2024-03-20 01:02:45.374501+00:00</td>\n",
       "      <td>128.963057</td>\n",
       "      <td>{'tags': 'aggressive hammered dulcimer, buzuq,...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>9d7c6c06-4742-49a5-bc1d-ac6500b3bfc0</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_a6e4dcb7-dcd0-4890-aa10-93af6645e2c1</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at  \\\n",
       "0  17d5fcc3-095e-468a-8719-bbdb40a72bd3 2024-03-20 01:02:45.374600+00:00   \n",
       "1  a6e4dcb7-dcd0-4890-aa10-93af6645e2c1 2024-03-20 01:02:45.374481+00:00   \n",
       "\n",
       "                        updated_at   time_used  \\\n",
       "0 2024-03-20 01:02:45.374607+00:00  122.459554   \n",
       "1 2024-03-20 01:02:45.374501+00:00  128.963057   \n",
       "\n",
       "                                            metadata  user_id    status  \\\n",
       "0  {'tags': 'aggressive hammered dulcimer, buzuq,...   144167  complete   \n",
       "1  {'tags': 'aggressive hammered dulcimer, buzuq,...   144167  complete   \n",
       "\n",
       "  discord_message_id prompt_id                            request_id  ...  \\\n",
       "0               None      None  9d7c6c06-4742-49a5-bc1d-ac6500b3bfc0  ...   \n",
       "1               None      None  9d7c6c06-4742-49a5-bc1d-ac6500b3bfc0  ...   \n",
       "\n",
       "   is_deleted                                 image_s3_id  is_public  \\\n",
       "0       False  image_17d5fcc3-095e-468a-8719-bbdb40a72bd3      False   \n",
       "1       False  image_a6e4dcb7-dcd0-4890-aa10-93af6645e2c1      False   \n",
       "\n",
       "   dislike_count flag_count play_count skip_count  title is_public_approved  \\\n",
       "0              0          0          7          0                     False   \n",
       "1              0          0          2          0                     False   \n",
       "\n",
       "   slug  \n",
       "0  None  \n",
       "1  None  \n",
       "\n",
       "[2 rows x 27 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip.tail(30)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "9dc2ba89",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-03-22T14:00:22.095775Z",
     "start_time": "2024-03-22T13:59:39.948381Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>created_at</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>time_used</th>\n",
       "      <th>metadata</th>\n",
       "      <th>user_id</th>\n",
       "      <th>status</th>\n",
       "      <th>discord_message_id</th>\n",
       "      <th>prompt_id</th>\n",
       "      <th>request_id</th>\n",
       "      <th>...</th>\n",
       "      <th>is_deleted</th>\n",
       "      <th>image_s3_id</th>\n",
       "      <th>is_public</th>\n",
       "      <th>dislike_count</th>\n",
       "      <th>flag_count</th>\n",
       "      <th>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>title</th>\n",
       "      <th>is_public_approved</th>\n",
       "      <th>slug</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>45756aac-8300-48b6-a18f-ad4d5b81500c</td>\n",
       "      <td>2023-12-27 19:16:20.932536+00:00</td>\n",
       "      <td>2023-12-27 19:16:20.932541+00:00</td>\n",
       "      <td>61.200269</td>\n",
       "      <td>{'tags': 'emo, modern, feminine', 'type': 'gen...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>d2ffb3bb-9dfa-4683-ac4d-532f591555bd</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_45756aac-8300-48b6-a18f-ad4d5b81500c</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>LG3</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>d35428b9-222a-4287-89cd-400c1cda8604</td>\n",
       "      <td>2023-11-16 03:04:48.850049+00:00</td>\n",
       "      <td>2023-11-16 03:04:48.850064+00:00</td>\n",
       "      <td>60.571814</td>\n",
       "      <td>{'tags': 'punk energetic rebellious', 'prompt'...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>cb2e5063-3c65-4d92-ba06-01cd1837fc59</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_cb2e5063-3c65-4d92-ba06-01cd1837fc59</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5f221036-a04b-42f3-8aa4-f16bb4229a88</td>\n",
       "      <td>2023-11-16 03:04:48.850111+00:00</td>\n",
       "      <td>2023-11-16 03:04:48.850114+00:00</td>\n",
       "      <td>60.571814</td>\n",
       "      <td>{'tags': 'punk energetic rebellious', 'prompt'...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>cb2e5063-3c65-4d92-ba06-01cd1837fc59</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_cb2e5063-3c65-4d92-ba06-01cd1837fc59</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>46e71a1e-137f-4473-8b82-78ce99f5521f</td>\n",
       "      <td>2023-11-16 03:10:00.095198+00:00</td>\n",
       "      <td>2023-11-16 03:10:00.095212+00:00</td>\n",
       "      <td>71.886144</td>\n",
       "      <td>{'tags': 'punk rock fast-paced rebellious', 'p...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>30ef7908-787f-40ba-a017-15fef4798a27</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_30ef7908-787f-40ba-a017-15fef4798a27</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>ae8b076f-21a3-4440-a5d0-a7521d68810a</td>\n",
       "      <td>2023-11-16 03:10:00.095264+00:00</td>\n",
       "      <td>2023-11-16 03:10:00.095267+00:00</td>\n",
       "      <td>71.886144</td>\n",
       "      <td>{'tags': 'punk rock fast-paced rebellious', 'p...</td>\n",
       "      <td>144167</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>30ef7908-787f-40ba-a017-15fef4798a27</td>\n",
       "      <td>...</td>\n",
       "      <td>False</td>\n",
       "      <td>image_30ef7908-787f-40ba-a017-15fef4798a27</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td></td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at  \\\n",
       "0  45756aac-8300-48b6-a18f-ad4d5b81500c 2023-12-27 19:16:20.932536+00:00   \n",
       "1  d35428b9-222a-4287-89cd-400c1cda8604 2023-11-16 03:04:48.850049+00:00   \n",
       "2  5f221036-a04b-42f3-8aa4-f16bb4229a88 2023-11-16 03:04:48.850111+00:00   \n",
       "3  46e71a1e-137f-4473-8b82-78ce99f5521f 2023-11-16 03:10:00.095198+00:00   \n",
       "4  ae8b076f-21a3-4440-a5d0-a7521d68810a 2023-11-16 03:10:00.095264+00:00   \n",
       "\n",
       "                        updated_at  time_used  \\\n",
       "0 2023-12-27 19:16:20.932541+00:00  61.200269   \n",
       "1 2023-11-16 03:04:48.850064+00:00  60.571814   \n",
       "2 2023-11-16 03:04:48.850114+00:00  60.571814   \n",
       "3 2023-11-16 03:10:00.095212+00:00  71.886144   \n",
       "4 2023-11-16 03:10:00.095267+00:00  71.886144   \n",
       "\n",
       "                                            metadata  user_id    status  \\\n",
       "0  {'tags': 'emo, modern, feminine', 'type': 'gen...   144167  complete   \n",
       "1  {'tags': 'punk energetic rebellious', 'prompt'...   144167  complete   \n",
       "2  {'tags': 'punk energetic rebellious', 'prompt'...   144167  complete   \n",
       "3  {'tags': 'punk rock fast-paced rebellious', 'p...   144167  complete   \n",
       "4  {'tags': 'punk rock fast-paced rebellious', 'p...   144167  complete   \n",
       "\n",
       "  discord_message_id prompt_id                            request_id  ...  \\\n",
       "0               None      None  d2ffb3bb-9dfa-4683-ac4d-532f591555bd  ...   \n",
       "1               None      None  cb2e5063-3c65-4d92-ba06-01cd1837fc59  ...   \n",
       "2               None      None  cb2e5063-3c65-4d92-ba06-01cd1837fc59  ...   \n",
       "3               None      None  30ef7908-787f-40ba-a017-15fef4798a27  ...   \n",
       "4               None      None  30ef7908-787f-40ba-a017-15fef4798a27  ...   \n",
       "\n",
       "   is_deleted                                 image_s3_id  is_public  \\\n",
       "0       False  image_45756aac-8300-48b6-a18f-ad4d5b81500c      False   \n",
       "1       False  image_cb2e5063-3c65-4d92-ba06-01cd1837fc59      False   \n",
       "2       False  image_cb2e5063-3c65-4d92-ba06-01cd1837fc59      False   \n",
       "3       False  image_30ef7908-787f-40ba-a017-15fef4798a27      False   \n",
       "4       False  image_30ef7908-787f-40ba-a017-15fef4798a27      False   \n",
       "\n",
       "   dislike_count flag_count play_count skip_count  title is_public_approved  \\\n",
       "0              0          0          2          0    LG3              False   \n",
       "1              0          0          0          0                     False   \n",
       "2              0          0          0          0                     False   \n",
       "3              0          0          0          0                     False   \n",
       "4              0          0          0          0                     False   \n",
       "\n",
       "   slug  \n",
       "0  None  \n",
       "1  None  \n",
       "2  None  \n",
       "3  None  \n",
       "4  None  \n",
       "\n",
       "[5 rows x 27 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_clip = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where user_id=144167;\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_clip.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8d18c2cc",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-03-22T14:00:22.100154Z",
     "start_time": "2024-03-22T14:00:22.097758Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_clip = pd.read_sql_query(\n",
    "#     \"\"\"select * from bots_generatedclip \n",
    "#     where title::text LIKE '%%this weekend is too busy for me%%';\"\"\",\n",
    "#     engine,\n",
    "# )\n",
    "# df_clip.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f5713936",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
