{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b32a920c",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:18.681658Z",
     "start_time": "2024-04-17T15:55:17.938238Z"
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/tmp/ipykernel_1236908/4086330464.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\n",
    "\n",
    "\n",
    "pd.set_option('display.max_rows', 500)\n",
    "pd.set_option('display.max_columns', 500)\n",
    "pd.set_option('display.width', 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4ba915d2",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:18.684453Z",
     "start_time": "2024-04-17T15:55:18.682884Z"
    }
   },
   "outputs": [],
   "source": [
    "# engine = sqlalchemy.create_engine(\"postgresql://studio_hga1_user:pJr5NeKjVZPxae5bp6am9qtLWVY8t5Ni@dpg-cgfrde82qv28tc0tavcg-a.ohio-postgres.render.com/studio_hga1\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bc9462d1",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:18.799063Z",
     "start_time": "2024-04-17T15:55:18.685449Z"
    }
   },
   "outputs": [],
   "source": [
    "engine = sqlalchemy.create_engine(\"postgresql://studio_hga1_user:pJr5NeKjVZPxae5bp6am9qtLWVY8t5Ni@dpg-cgfrde82qv28tc0tavcg-d.replica-cyan.ohio-postgres.render.com/studio_hga1\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bef3a106",
   "metadata": {},
   "source": [
    "# Some example queries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "46539c34",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:19.664584Z",
     "start_time": "2024-04-17T15:55:18.800845Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['auth_group' 'auth_group_permissions' 'auth_permission' 'auth_user'\n",
      " 'auth_user_groups' 'auth_user_user_permissions' 'awsdms_ddl_audit'\n",
      " 'bots_actionlogging' 'bots_clipdiscordmessage' 'bots_clipprompt'\n",
      " 'bots_creditpack' 'bots_dailytheme' 'bots_discordinfo'\n",
      " 'bots_generatedclip' 'bots_generatedclipextra' 'bots_generatedplaylist'\n",
      " 'bots_generatedplaylistoverride' 'bots_generationrequest'\n",
      " 'bots_modeltype' 'bots_periodcreditusage' 'bots_playlist'\n",
      " 'bots_playlistclip' 'bots_profilefollow' 'bots_promptinspiration'\n",
      " 'bots_purchaseinfo' 'bots_usageplan' 'bots_userplaylistreaction'\n",
      " 'bots_userreaction' 'clips_clip' 'clips_clip_playlists' 'clips_clip_tags'\n",
      " 'clips_playlist' 'clips_tag' 'clips_team' 'clips_teammembership'\n",
      " 'clips_textprompt' 'clips_textprompt_tags' 'clips_usercliprating'\n",
      " 'clips_usertoken' 'configs_flag' 'configs_flag_groups'\n",
      " 'configs_flag_users' 'configs_sample' 'configs_switch' 'django_admin_log'\n",
      " 'django_content_type' 'django_migrations' 'django_session'\n",
      " 'pg_stat_statements' 'pg_stat_statements_info' 'waffle_flag'\n",
      " 'waffle_flag_groups' 'waffle_flag_users' 'waffle_sample' 'waffle_switch']\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": 5,
   "id": "c46cfa33",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:19.901778Z",
     "start_time": "2024-04-17T15:55:19.666361Z"
    }
   },
   "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>relative_index</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>clip_id</th>\n",
       "      <th>playlist_id</th>\n",
       "      <th>updated_by_id</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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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>41145394</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2024-04-17 15:47:02.380986+00:00</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>2024-04-16 12:42:02.762334+00:00</td>\n",
       "      <td>2024-04-16 12:42:02.762353+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'Bass. Miku voice, Vocaloid. night-lo...</td>\n",
       "      <td>6646918</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>1255</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_52b0728a-ec6c-47b8-bbe9-7ec9b7b8ca35</td>\n",
       "      <td>True</td>\n",
       "      <td>31</td>\n",
       "      <td>6</td>\n",
       "      <td>75931</td>\n",
       "      <td>0</td>\n",
       "      <td>もし君が月だったら (If You Were the Moon)</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>41145395</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2024-04-17 15:47:02.381029+00:00</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>2024-04-16 20:24:32.834915+00:00</td>\n",
       "      <td>2024-04-16 20:24:32.834937+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': '16th century, dungeons and dragons, ...</td>\n",
       "      <td>10956145</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>524</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_f4ee5a5f-5b98-49b8-ac0f-1e55c8ab2b97</td>\n",
       "      <td>True</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>19077</td>\n",
       "      <td>0</td>\n",
       "      <td>The Drunken Dragon</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>41145396</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2024-04-17 15:47:02.381050+00:00</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>2024-04-16 15:24:26.621043+00:00</td>\n",
       "      <td>2024-04-16 15:24:26.621060+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'rap rock, alternative metal, nu meta...</td>\n",
       "      <td>7668197</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>775</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_b6472373-076c-4d4a-8381-f305bf4eceb4</td>\n",
       "      <td>True</td>\n",
       "      <td>21</td>\n",
       "      <td>3</td>\n",
       "      <td>37171</td>\n",
       "      <td>0</td>\n",
       "      <td>Pinkin Lark</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>41145397</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2024-04-17 15:47:02.381070+00:00</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>2024-04-17 12:45:44.130837+00:00</td>\n",
       "      <td>2024-04-17 12:45:44.130856+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'hair/glam metal, incredible electric...</td>\n",
       "      <td>4018923</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>68</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_a56ea817-8814-4a4a-a164-3a06d30fbe96</td>\n",
       "      <td>True</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3442</td>\n",
       "      <td>0</td>\n",
       "      <td>Don't Care Now</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>41145398</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2024-04-17 15:47:02.381089+00:00</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>2024-04-15 14:04:43.047007+00:00</td>\n",
       "      <td>2024-04-15 14:04:43.047032+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'electric guitar intro, high notes, h...</td>\n",
       "      <td>4018923</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>2316</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_e1f27710-8164-4274-a93c-30f9b2f11b0d</td>\n",
       "      <td>True</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>150627</td>\n",
       "      <td>0</td>\n",
       "      <td>Stardust Highway Run</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         id  relative_index                       updated_at                               clip_id                           playlist_id  updated_by_id                                    id                       created_at                       updated_at  time_used                                           metadata   user_id    status discord_message_id prompt_id request_id  is_generated                                 s3_id  upvote_count  batch_index         model_name prompt_text daily_theme_id  is_deleted                                 image_s3_id  is_public  dislike_count  flag_count  play_count  skip_count                             title  slug\n",
       "0  41145394             0.0 2024-04-17 15:47:02.380986+00:00  2c7d0323-71ef-4f9b-a60f-ab9502012450  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  2c7d0323-71ef-4f9b-a60f-ab9502012450 2024-04-16 12:42:02.762334+00:00 2024-04-16 12:42:02.762353+00:00        0.0  {'tags': 'Bass. Miku voice, Vocaloid. night-lo...   6646918  complete               None      None       None          True  2c7d0323-71ef-4f9b-a60f-ab9502012450          1255            0  chirp-v3-engine-i                       None       False  image_52b0728a-ec6c-47b8-bbe9-7ec9b7b8ca35       True             31           6       75931           0  もし君が月だったら (If You Were the Moon)  None\n",
       "1  41145395             1.0 2024-04-17 15:47:02.381029+00:00  d79e4c5e-610d-462a-990a-e00837b603c7  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  d79e4c5e-610d-462a-990a-e00837b603c7 2024-04-16 20:24:32.834915+00:00 2024-04-16 20:24:32.834937+00:00        0.0  {'tags': '16th century, dungeons and dragons, ...  10956145  complete               None      None       None          True  d79e4c5e-610d-462a-990a-e00837b603c7           524            0  chirp-v3-engine-i                       None       False  image_f4ee5a5f-5b98-49b8-ac0f-1e55c8ab2b97       True              5           0       19077           0                The Drunken Dragon  None\n",
       "2  41145396             2.0 2024-04-17 15:47:02.381050+00:00  7e14e565-31e6-424f-a2ab-8ebc30ce1832  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  7e14e565-31e6-424f-a2ab-8ebc30ce1832 2024-04-16 15:24:26.621043+00:00 2024-04-16 15:24:26.621060+00:00        0.0  {'tags': 'rap rock, alternative metal, nu meta...   7668197  complete               None      None       None          True  7e14e565-31e6-424f-a2ab-8ebc30ce1832           775            0  chirp-v3-engine-i                       None       False  image_b6472373-076c-4d4a-8381-f305bf4eceb4       True             21           3       37171           0                       Pinkin Lark  None\n",
       "3  41145397             3.0 2024-04-17 15:47:02.381070+00:00  81211f0c-77e9-4620-a758-c3391dabe349  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  81211f0c-77e9-4620-a758-c3391dabe349 2024-04-17 12:45:44.130837+00:00 2024-04-17 12:45:44.130856+00:00        0.0  {'tags': 'hair/glam metal, incredible electric...   4018923  complete               None      None       None          True  81211f0c-77e9-4620-a758-c3391dabe349            68            0  chirp-v3-engine-i                       None       False  image_a56ea817-8814-4a4a-a164-3a06d30fbe96       True              1           0        3442           0                    Don't Care Now  None\n",
       "4  41145398             4.0 2024-04-17 15:47:02.381089+00:00  88b77079-07af-413e-a565-9a87d574e0e8  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  88b77079-07af-413e-a565-9a87d574e0e8 2024-04-15 14:04:43.047007+00:00 2024-04-15 14:04:43.047032+00:00        0.0  {'tags': 'electric guitar intro, high notes, h...   4018923  complete               None      None       None          True  88b77079-07af-413e-a565-9a87d574e0e8          2316            0  chirp-v3-engine-i                       None       False  image_e1f27710-8164-4274-a93c-30f9b2f11b0d       True             38           8      150627           0              Stardust Highway Run  None"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_playlistclip \n",
    "    join bots_generatedclip on bots_playlistclip.clip_id = bots_generatedclip.id \n",
    "    where playlist_id = '1190bf92-10dc-4ce5-968a-7a377f37f984';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_trending.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "902ee32f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:20.069560Z",
     "start_time": "2024-04-17T15:55:19.903058Z"
    }
   },
   "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>relative_index</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>clip_id</th>\n",
       "      <th>playlist_id</th>\n",
       "      <th>updated_by_id</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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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",
       "      <th>id</th>\n",
       "      <th>password</th>\n",
       "      <th>last_login</th>\n",
       "      <th>is_superuser</th>\n",
       "      <th>username</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>email</th>\n",
       "      <th>is_staff</th>\n",
       "      <th>is_active</th>\n",
       "      <th>date_joined</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>41145394</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2024-04-17 15:47:02.380986+00:00</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>2024-04-16 12:42:02.762334+00:00</td>\n",
       "      <td>2024-04-16 12:42:02.762353+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'Bass. Miku voice, Vocaloid. night-lo...</td>\n",
       "      <td>6646918</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>2c7d0323-71ef-4f9b-a60f-ab9502012450</td>\n",
       "      <td>1255</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_52b0728a-ec6c-47b8-bbe9-7ec9b7b8ca35</td>\n",
       "      <td>True</td>\n",
       "      <td>31</td>\n",
       "      <td>6</td>\n",
       "      <td>75931</td>\n",
       "      <td>0</td>\n",
       "      <td>もし君が月だったら (If You Were the Moon)</td>\n",
       "      <td>None</td>\n",
       "      <td>6646918</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>20031115god2@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>20031115god2@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-03-23 19:12:18.488247+00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>41145395</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2024-04-17 15:47:02.381029+00:00</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>2024-04-16 20:24:32.834915+00:00</td>\n",
       "      <td>2024-04-16 20:24:32.834937+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': '16th century, dungeons and dragons, ...</td>\n",
       "      <td>10956145</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>d79e4c5e-610d-462a-990a-e00837b603c7</td>\n",
       "      <td>524</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_f4ee5a5f-5b98-49b8-ac0f-1e55c8ab2b97</td>\n",
       "      <td>True</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>19077</td>\n",
       "      <td>0</td>\n",
       "      <td>The Drunken Dragon</td>\n",
       "      <td>None</td>\n",
       "      <td>10956145</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>spencerln66@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>spencerln66@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-04-08 10:34:28.617079+00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>41145396</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2024-04-17 15:47:02.381050+00:00</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>2024-04-16 15:24:26.621043+00:00</td>\n",
       "      <td>2024-04-16 15:24:26.621060+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'rap rock, alternative metal, nu meta...</td>\n",
       "      <td>7668197</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>7e14e565-31e6-424f-a2ab-8ebc30ce1832</td>\n",
       "      <td>775</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_b6472373-076c-4d4a-8381-f305bf4eceb4</td>\n",
       "      <td>True</td>\n",
       "      <td>21</td>\n",
       "      <td>3</td>\n",
       "      <td>37171</td>\n",
       "      <td>0</td>\n",
       "      <td>Pinkin Lark</td>\n",
       "      <td>None</td>\n",
       "      <td>7668197</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>c.r.klepacki@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>c.r.klepacki@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-03-28 16:59:51.264029+00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>41145397</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2024-04-17 15:47:02.381070+00:00</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>2024-04-17 12:45:44.130837+00:00</td>\n",
       "      <td>2024-04-17 12:45:44.130856+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'hair/glam metal, incredible electric...</td>\n",
       "      <td>4018923</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>81211f0c-77e9-4620-a758-c3391dabe349</td>\n",
       "      <td>68</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_a56ea817-8814-4a4a-a164-3a06d30fbe96</td>\n",
       "      <td>True</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3442</td>\n",
       "      <td>0</td>\n",
       "      <td>Don't Care Now</td>\n",
       "      <td>None</td>\n",
       "      <td>4018923</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>guffleaks@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>guffleaks@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-01-31 17:00:02.720555+00:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>41145398</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2024-04-17 15:47:02.381089+00:00</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>1190bf92-10dc-4ce5-968a-7a377f37f984</td>\n",
       "      <td>3575657</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>2024-04-15 14:04:43.047007+00:00</td>\n",
       "      <td>2024-04-15 14:04:43.047032+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'electric guitar intro, high notes, h...</td>\n",
       "      <td>4018923</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>88b77079-07af-413e-a565-9a87d574e0e8</td>\n",
       "      <td>2316</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_e1f27710-8164-4274-a93c-30f9b2f11b0d</td>\n",
       "      <td>True</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>150627</td>\n",
       "      <td>0</td>\n",
       "      <td>Stardust Highway Run</td>\n",
       "      <td>None</td>\n",
       "      <td>4018923</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>guffleaks@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>guffleaks@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-01-31 17:00:02.720555+00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         id  relative_index                       updated_at                               clip_id                           playlist_id  updated_by_id                                    id                       created_at                       updated_at  time_used                                           metadata   user_id    status discord_message_id prompt_id request_id  is_generated                                 s3_id  upvote_count  batch_index         model_name prompt_text daily_theme_id  is_deleted                                 image_s3_id  is_public  dislike_count  flag_count  play_count  skip_count                             title  slug        id password last_login  is_superuser                username first_name last_name                   email  is_staff  is_active                      date_joined\n",
       "0  41145394             0.0 2024-04-17 15:47:02.380986+00:00  2c7d0323-71ef-4f9b-a60f-ab9502012450  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  2c7d0323-71ef-4f9b-a60f-ab9502012450 2024-04-16 12:42:02.762334+00:00 2024-04-16 12:42:02.762353+00:00        0.0  {'tags': 'Bass. Miku voice, Vocaloid. night-lo...   6646918  complete               None      None       None          True  2c7d0323-71ef-4f9b-a60f-ab9502012450          1255            0  chirp-v3-engine-i                       None       False  image_52b0728a-ec6c-47b8-bbe9-7ec9b7b8ca35       True             31           6       75931           0  もし君が月だったら (If You Were the Moon)  None   6646918                None         False  20031115god2@gmail.com                       20031115god2@gmail.com     False       True 2024-03-23 19:12:18.488247+00:00\n",
       "1  41145395             1.0 2024-04-17 15:47:02.381029+00:00  d79e4c5e-610d-462a-990a-e00837b603c7  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  d79e4c5e-610d-462a-990a-e00837b603c7 2024-04-16 20:24:32.834915+00:00 2024-04-16 20:24:32.834937+00:00        0.0  {'tags': '16th century, dungeons and dragons, ...  10956145  complete               None      None       None          True  d79e4c5e-610d-462a-990a-e00837b603c7           524            0  chirp-v3-engine-i                       None       False  image_f4ee5a5f-5b98-49b8-ac0f-1e55c8ab2b97       True              5           0       19077           0                The Drunken Dragon  None  10956145                None         False   spencerln66@gmail.com                        spencerln66@gmail.com     False       True 2024-04-08 10:34:28.617079+00:00\n",
       "2  41145396             2.0 2024-04-17 15:47:02.381050+00:00  7e14e565-31e6-424f-a2ab-8ebc30ce1832  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  7e14e565-31e6-424f-a2ab-8ebc30ce1832 2024-04-16 15:24:26.621043+00:00 2024-04-16 15:24:26.621060+00:00        0.0  {'tags': 'rap rock, alternative metal, nu meta...   7668197  complete               None      None       None          True  7e14e565-31e6-424f-a2ab-8ebc30ce1832           775            0  chirp-v3-engine-i                       None       False  image_b6472373-076c-4d4a-8381-f305bf4eceb4       True             21           3       37171           0                       Pinkin Lark  None   7668197                None         False  c.r.klepacki@gmail.com                       c.r.klepacki@gmail.com     False       True 2024-03-28 16:59:51.264029+00:00\n",
       "3  41145397             3.0 2024-04-17 15:47:02.381070+00:00  81211f0c-77e9-4620-a758-c3391dabe349  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  81211f0c-77e9-4620-a758-c3391dabe349 2024-04-17 12:45:44.130837+00:00 2024-04-17 12:45:44.130856+00:00        0.0  {'tags': 'hair/glam metal, incredible electric...   4018923  complete               None      None       None          True  81211f0c-77e9-4620-a758-c3391dabe349            68            0  chirp-v3-engine-i                       None       False  image_a56ea817-8814-4a4a-a164-3a06d30fbe96       True              1           0        3442           0                    Don't Care Now  None   4018923                None         False     guffleaks@gmail.com                          guffleaks@gmail.com     False       True 2024-01-31 17:00:02.720555+00:00\n",
       "4  41145398             4.0 2024-04-17 15:47:02.381089+00:00  88b77079-07af-413e-a565-9a87d574e0e8  1190bf92-10dc-4ce5-968a-7a377f37f984        3575657  88b77079-07af-413e-a565-9a87d574e0e8 2024-04-15 14:04:43.047007+00:00 2024-04-15 14:04:43.047032+00:00        0.0  {'tags': 'electric guitar intro, high notes, h...   4018923  complete               None      None       None          True  88b77079-07af-413e-a565-9a87d574e0e8          2316            0  chirp-v3-engine-i                       None       False  image_e1f27710-8164-4274-a93c-30f9b2f11b0d       True             38           8      150627           0              Stardust Highway Run  None   4018923                None         False     guffleaks@gmail.com                          guffleaks@gmail.com     False       True 2024-01-31 17:00:02.720555+00:00"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_user = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_playlistclip \n",
    "    join bots_generatedclip on bots_playlistclip.clip_id = bots_generatedclip.id \n",
    "    join auth_user on bots_generatedclip.user_id = auth_user.id \n",
    "    where playlist_id = '1190bf92-10dc-4ce5-968a-7a377f37f984';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_user.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "f914772f",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-20T01:28:55.613739Z",
     "start_time": "2024-04-20T01:28:55.506202Z"
    }
   },
   "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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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>90fe64a0-0958-49dc-b612-74879edbca90</td>\n",
       "      <td>2024-04-07 21:05:10.968396+00:00</td>\n",
       "      <td>2024-04-07 21:05:10.968409+00:00</td>\n",
       "      <td>245.565986</td>\n",
       "      <td>{'tags': 'synthpop', 'type': 'gen', 'prompt': ...</td>\n",
       "      <td>2210602</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>7adb2071-4f35-435c-bff0-78fb850b5fae</td>\n",
       "      <td>True</td>\n",
       "      <td>90fe64a0-0958-49dc-b612-74879edbca90</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_90fe64a0-0958-49dc-b612-74879edbca90</td>\n",
       "      <td>True</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>25</td>\n",
       "      <td>0</td>\n",
       "      <td>Make a synth rap</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4b01629f-3e85-4f76-86ce-b9f43d539431</td>\n",
       "      <td>2024-04-07 21:05:10.968495+00:00</td>\n",
       "      <td>2024-04-07 21:05:10.968503+00:00</td>\n",
       "      <td>176.110321</td>\n",
       "      <td>{'tags': 'synthpop', 'type': 'gen', 'prompt': ...</td>\n",
       "      <td>2210602</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>7adb2071-4f35-435c-bff0-78fb850b5fae</td>\n",
       "      <td>True</td>\n",
       "      <td>4b01629f-3e85-4f76-86ce-b9f43d539431</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_4b01629f-3e85-4f76-86ce-b9f43d539431</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>Bad driver literally ryan gosling</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at                       updated_at   time_used                                           metadata  user_id    status discord_message_id prompt_id                            request_id  is_generated                                 s3_id  upvote_count  batch_index         model_name prompt_text daily_theme_id  is_deleted                                 image_s3_id  is_public  dislike_count  flag_count  play_count  skip_count                              title  slug\n",
       "0  90fe64a0-0958-49dc-b612-74879edbca90 2024-04-07 21:05:10.968396+00:00 2024-04-07 21:05:10.968409+00:00  245.565986  {'tags': 'synthpop', 'type': 'gen', 'prompt': ...  2210602  complete               None      None  7adb2071-4f35-435c-bff0-78fb850b5fae          True  90fe64a0-0958-49dc-b612-74879edbca90             0            0  chirp-v3-engine-i                       None       False  image_90fe64a0-0958-49dc-b612-74879edbca90       True              0           0          25           0                   Make a synth rap  None\n",
       "1  4b01629f-3e85-4f76-86ce-b9f43d539431 2024-04-07 21:05:10.968495+00:00 2024-04-07 21:05:10.968503+00:00  176.110321  {'tags': 'synthpop', 'type': 'gen', 'prompt': ...  2210602  complete               None      None  7adb2071-4f35-435c-bff0-78fb850b5fae          True  4b01629f-3e85-4f76-86ce-b9f43d539431             2            1  chirp-v3-engine-i                       None       False  image_4b01629f-3e85-4f76-86ce-b9f43d539431      False              0           0           7           0  Bad driver literally ryan gosling  None"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where request_id\t = '7adb2071-4f35-435c-bff0-78fb850b5fae';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_trending"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "7033b4a6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-20T01:29:13.545081Z",
     "start_time": "2024-04-20T01:29:13.542412Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'tags': 'synthpop',\n",
       " 'type': 'gen',\n",
       " 'prompt': '',\n",
       " 'stream': True,\n",
       " 'history': [{'id': None, 'continue_at': 6.0}],\n",
       " 'options': None,\n",
       " 'duration': 118.4,\n",
       " 'priority': 10,\n",
       " 'experiment': ['chirp-v3-engine-i', 'chirp-v3-engine-i'],\n",
       " 'gpt_prompt': None,\n",
       " 'continue_at': 6.0,\n",
       " 'refund_credits': False,\n",
       " 'audio_prompt_id': None,\n",
       " 'make_instrumental': False,\n",
       " 'continued_from_prompt': '',\n",
       " 'gpt_description_prompt': None}"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending[\"metadata\"][1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "ce8ece85",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-26T14:44:04.427761Z",
     "start_time": "2024-04-26T14:44:04.316750Z"
    }
   },
   "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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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>44befd89-c62d-45ca-897b-91cdecbfbae5</td>\n",
       "      <td>2024-04-23 10:44:52.803481+00:00</td>\n",
       "      <td>2024-04-23 10:44:52.803499+00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>{'tags': 'witch house', 'type': 'concat', 'pro...</td>\n",
       "      <td>11868251</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>True</td>\n",
       "      <td>44befd89-c62d-45ca-897b-91cdecbfbae5</td>\n",
       "      <td>1428</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_5969a252-af53-4ca4-ad20-564aee83308a</td>\n",
       "      <td>True</td>\n",
       "      <td>30</td>\n",
       "      <td>15</td>\n",
       "      <td>69230</td>\n",
       "      <td>0</td>\n",
       "      <td>×××××</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                     id                       created_at                       updated_at  time_used                                           metadata   user_id    status discord_message_id prompt_id request_id  is_generated                                 s3_id  upvote_count  batch_index         model_name prompt_text daily_theme_id  is_deleted                                 image_s3_id  is_public  dislike_count  flag_count  play_count  skip_count  title  slug\n",
       "0  44befd89-c62d-45ca-897b-91cdecbfbae5 2024-04-23 10:44:52.803481+00:00 2024-04-23 10:44:52.803499+00:00        0.0  {'tags': 'witch house', 'type': 'concat', 'pro...  11868251  complete               None      None       None          True  44befd89-c62d-45ca-897b-91cdecbfbae5          1428            0  chirp-v3-engine-i                       None       False  image_5969a252-af53-4ca4-ad20-564aee83308a       True             30          15       69230           0  ×××××  None"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where id = '44befd89-c62d-45ca-897b-91cdecbfbae5';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_trending"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "efd95ac5",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-26T14:44:14.120905Z",
     "start_time": "2024-04-26T14:44:14.118361Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'tags': 'witch house',\n",
       " 'type': 'concat',\n",
       " 'prompt': 'Alpha (α), Beta (β), Gamma (γ), Delta (δ), Epsilon (ε), Zeta (ζ), Eta (η), Theta (θ), Iota (ι), Kappa (κ), Upsilon (υ), Sigma (σ), Omega (ω)\\n\\n Demonic eyes [for the picture]',\n",
       " 'duration': 120.99997916666666,\n",
       " 'image_s3_id': 'image_5969a252-af53-4ca4-ad20-564aee83308a',\n",
       " 'concat_history': [{'id': 'b294ab64-bbfa-4913-b291-ff0009b26abd',\n",
       "   'continue_at': 118.4},\n",
       "  {'id': '5969a252-af53-4ca4-ad20-564aee83308a', 'continue_at': None}]}"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending[\"metadata\"][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "ba8f1054",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:20.281874Z",
     "start_time": "2024-04-17T15:55:20.180616Z"
    }
   },
   "outputs": [],
   "source": [
    "query = \"\"\"\n",
    "SELECT * FROM bots_userreaction\n",
    "WHERE clip_id = '14974ef2-d996-4aca-9406-d230b0014c3d';\n",
    "\"\"\"\n",
    "upvoted_df = pd.read_sql_query(query, engine)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "33e36e37",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:20.288259Z",
     "start_time": "2024-04-17T15:55:20.283442Z"
    }
   },
   "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>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>flagged</th>\n",
       "      <th>flagged_reason</th>\n",
       "      <th>reaction_type</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>clip_id</th>\n",
       "      <th>user_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>81527730</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>L</td>\n",
       "      <td>2024-03-25 20:45:29.628653+00:00</td>\n",
       "      <td>14974ef2-d996-4aca-9406-d230b0014c3d</td>\n",
       "      <td>1317972</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>81531785</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>L</td>\n",
       "      <td>2024-03-25 20:47:18.985967+00:00</td>\n",
       "      <td>14974ef2-d996-4aca-9406-d230b0014c3d</td>\n",
       "      <td>5802119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>81531008</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>L</td>\n",
       "      <td>2024-03-25 20:46:57.350635+00:00</td>\n",
       "      <td>14974ef2-d996-4aca-9406-d230b0014c3d</td>\n",
       "      <td>2933808</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>81532750</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>L</td>\n",
       "      <td>2024-03-25 20:47:44.969561+00:00</td>\n",
       "      <td>14974ef2-d996-4aca-9406-d230b0014c3d</td>\n",
       "      <td>1218435</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         id  play_count  skip_count  flagged flagged_reason reaction_type                       updated_at                               clip_id  user_id\n",
       "0  81527730           7           0    False           None             L 2024-03-25 20:45:29.628653+00:00  14974ef2-d996-4aca-9406-d230b0014c3d  1317972\n",
       "1  81531785           0           0    False           None             L 2024-03-25 20:47:18.985967+00:00  14974ef2-d996-4aca-9406-d230b0014c3d  5802119\n",
       "2  81531008           0           0    False           None             L 2024-03-25 20:46:57.350635+00:00  14974ef2-d996-4aca-9406-d230b0014c3d  2933808\n",
       "3  81532750           1           0    False           None             L 2024-03-25 20:47:44.969561+00:00  14974ef2-d996-4aca-9406-d230b0014c3d  1218435"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "upvoted_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f015132a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "53dbac99",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:20.356402Z",
     "start_time": "2024-04-17T15:55:20.289246Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'chirp-v3-engine-i'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending[\"model_name\"][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "8ee4d74b",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:20.417509Z",
     "start_time": "2024-04-17T15:55:20.357384Z"
    }
   },
   "outputs": [],
   "source": [
    "# df_trending = pd.read_sql_query(\n",
    "#     \"\"\"select * from bots_generatedclip \n",
    "#     where title LIKE 'Can''t Stop My Brain';\"\"\",\n",
    "#     engine,\n",
    "# )\n",
    "# df_trending.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "d06c1ab3",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.187616Z",
     "start_time": "2024-04-17T15:55:20.419019Z"
    }
   },
   "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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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>f02ba4b3-3205-4980-9fae-5e2adfcbaade</td>\n",
       "      <td>2023-11-17 05:59:07.920525+00:00</td>\n",
       "      <td>2023-11-17 05:59:07.920529+00:00</td>\n",
       "      <td>61.012114</td>\n",
       "      <td>{'tags': '\"trance nostalgic euphoric\"', 'promp...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be</td>\n",
       "      <td>True</td>\n",
       "      <td>cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be_1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v2-xxl-test</td>\n",
       "      <td>[Verse]\\nIn the silence of the night, I close ...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be</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>827633ba-8b50-40a2-93ce-dda42e37f6fa</td>\n",
       "      <td>2023-11-17 06:10:34.771276+00:00</td>\n",
       "      <td>2023-11-17 06:10:34.771289+00:00</td>\n",
       "      <td>66.054147</td>\n",
       "      <td>{'tags': 'trance melodic uplifting', 'prompt':...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>dcbfc88a-361f-4a99-bca8-6f300feba34f</td>\n",
       "      <td>True</td>\n",
       "      <td>dcbfc88a-361f-4a99-bca8-6f300feba34f_0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v2-xxl-test</td>\n",
       "      <td>[Verse]\\nLost in a world of dreams and fantasy...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_dcbfc88a-361f-4a99-bca8-6f300feba34f</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>2</th>\n",
       "      <td>caefbff9-71f5-471a-bcbe-9fa0892a0771</td>\n",
       "      <td>2023-11-17 06:10:34.771346+00:00</td>\n",
       "      <td>2023-11-17 06:10:34.771350+00:00</td>\n",
       "      <td>66.054147</td>\n",
       "      <td>{'tags': 'trance melodic uplifting', 'prompt':...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>dcbfc88a-361f-4a99-bca8-6f300feba34f</td>\n",
       "      <td>True</td>\n",
       "      <td>dcbfc88a-361f-4a99-bca8-6f300feba34f_1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v2-xxl-test</td>\n",
       "      <td>[Verse]\\nLost in a world of dreams and fantasy...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_dcbfc88a-361f-4a99-bca8-6f300feba34f</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>3</th>\n",
       "      <td>147b16a9-078e-43b2-b94d-f5f36acf5b9e</td>\n",
       "      <td>2023-11-17 06:14:30.555494+00:00</td>\n",
       "      <td>2023-11-17 06:14:30.555507+00:00</td>\n",
       "      <td>67.441263</td>\n",
       "      <td>{'tags': 'trance emotional ethereal', 'prompt'...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>e2328f97-3b1d-4e3d-80b8-8bb7a259c208</td>\n",
       "      <td>True</td>\n",
       "      <td>e2328f97-3b1d-4e3d-80b8-8bb7a259c208_0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v2-xxl-test</td>\n",
       "      <td>[Verse]\\nLost in her thoughts, she dreams of a...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_e2328f97-3b1d-4e3d-80b8-8bb7a259c208</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>4</th>\n",
       "      <td>117f7bcc-8c8c-4b23-90e2-d0e9207802d7</td>\n",
       "      <td>2023-11-17 06:14:30.555554+00:00</td>\n",
       "      <td>2023-11-17 06:14:30.555558+00:00</td>\n",
       "      <td>67.441263</td>\n",
       "      <td>{'tags': 'trance emotional ethereal', 'prompt'...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>e2328f97-3b1d-4e3d-80b8-8bb7a259c208</td>\n",
       "      <td>True</td>\n",
       "      <td>e2328f97-3b1d-4e3d-80b8-8bb7a259c208_1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v2-xxl-test</td>\n",
       "      <td>[Verse]\\nLost in her thoughts, she dreams of a...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_e2328f97-3b1d-4e3d-80b8-8bb7a259c208</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>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>754</th>\n",
       "      <td>e8d1d429-fd17-43c9-9761-64179b6f2590</td>\n",
       "      <td>2024-03-22 05:44:57.132125+00:00</td>\n",
       "      <td>2024-03-22 05:44:57.132138+00:00</td>\n",
       "      <td>86.096411</td>\n",
       "      <td>{'tags': 'alt rock, alternative, emo, band, em...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>70f31ff4-2493-40cf-ad50-ed4e933b3290</td>\n",
       "      <td>True</td>\n",
       "      <td>e8d1d429-fd17-43c9-9761-64179b6f2590</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td>[Intro]\\nLet me tell you 'bout a game I hold\\n...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_e8d1d429-fd17-43c9-9761-64179b6f2590</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>Axe Dogmas</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>755</th>\n",
       "      <td>9861470d-bd55-4ede-9d72-32dbdfe57582</td>\n",
       "      <td>2024-03-22 05:47:06.546553+00:00</td>\n",
       "      <td>2024-03-22 05:47:06.546568+00:00</td>\n",
       "      <td>98.401980</td>\n",
       "      <td>{'tags': 'alt rock, alternative, emo, band, em...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>54b10779-c493-4bd6-bc03-a73b9e4cde6d</td>\n",
       "      <td>True</td>\n",
       "      <td>9861470d-bd55-4ede-9d72-32dbdfe57582</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td>[Intro]\\nLet me tell you 'bout a game I hold\\n...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_9861470d-bd55-4ede-9d72-32dbdfe57582</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>Axe Dogmas</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>756</th>\n",
       "      <td>17f09fbc-43b7-40c4-8c97-724e60b5b209</td>\n",
       "      <td>2024-03-22 05:47:06.546683+00:00</td>\n",
       "      <td>2024-03-22 05:47:06.546693+00:00</td>\n",
       "      <td>110.533844</td>\n",
       "      <td>{'tags': 'alt rock, alternative, emo, band, em...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>54b10779-c493-4bd6-bc03-a73b9e4cde6d</td>\n",
       "      <td>True</td>\n",
       "      <td>17f09fbc-43b7-40c4-8c97-724e60b5b209</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td>[Intro]\\nLet me tell you 'bout a game I hold\\n...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_17f09fbc-43b7-40c4-8c97-724e60b5b209</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>Axe Dogmas</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>757</th>\n",
       "      <td>1ee83905-e341-4acb-b3d3-9b4f4eb2cccd</td>\n",
       "      <td>2024-03-22 05:44:40.135345+00:00</td>\n",
       "      <td>2024-03-22 05:44:40.135367+00:00</td>\n",
       "      <td>121.463419</td>\n",
       "      <td>{'tags': 'alt rock, alternative, emo, band, em...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>5e6dc836-bdfb-4125-b0f6-ce8f4de193e1</td>\n",
       "      <td>True</td>\n",
       "      <td>1ee83905-e341-4acb-b3d3-9b4f4eb2cccd</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>chirp-v3-engine-i</td>\n",
       "      <td>[Intro]\\nLet me tell you 'bout a game I hold\\n...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_1ee83905-e341-4acb-b3d3-9b4f4eb2cccd</td>\n",
       "      <td>True</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>Axe Dogmas</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>758</th>\n",
       "      <td>fcb7935e-110d-4ce1-9711-87c36208a4d0</td>\n",
       "      <td>2023-12-27 02:00:11.863564+00:00</td>\n",
       "      <td>2023-12-27 02:00:11.863569+00:00</td>\n",
       "      <td>62.523632</td>\n",
       "      <td>{'tags': '90s R&amp;B, Romantic, Glowing, Sexy, Se...</td>\n",
       "      <td>163823</td>\n",
       "      <td>complete</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>41626e6a-117d-4348-a3ea-b97aa0a1afae</td>\n",
       "      <td>True</td>\n",
       "      <td>fcb7935e-110d-4ce1-9711-87c36208a4d0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>chirp-v2-xxl-alpha</td>\n",
       "      <td>[Verse 1]\\nIn the moonlit game, it's a cosmic ...</td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>image_fcb7935e-110d-4ce1-9711-87c36208a4d0</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>89</td>\n",
       "      <td>0</td>\n",
       "      <td>Celestial Pulse</td>\n",
       "      <td>None</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>759 rows × 26 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                       id                       created_at                       updated_at   time_used                                           metadata  user_id    status discord_message_id prompt_id                            request_id  is_generated                                   s3_id  upvote_count  batch_index          model_name                                        prompt_text daily_theme_id  is_deleted                                 image_s3_id  is_public  dislike_count  flag_count  play_count  skip_count            title  slug\n",
       "0    f02ba4b3-3205-4980-9fae-5e2adfcbaade 2023-11-17 05:59:07.920525+00:00 2023-11-17 05:59:07.920529+00:00   61.012114  {'tags': '\"trance nostalgic euphoric\"', 'promp...   163823  complete               None      None  cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be          True  cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be_1             0            1   chirp-v2-xxl-test  [Verse]\\nIn the silence of the night, I close ...           None       False  image_cd3e5438-afb9-48b2-9a4e-76b2f9e0d4be      False              0           0           0           0                   None\n",
       "1    827633ba-8b50-40a2-93ce-dda42e37f6fa 2023-11-17 06:10:34.771276+00:00 2023-11-17 06:10:34.771289+00:00   66.054147  {'tags': 'trance melodic uplifting', 'prompt':...   163823  complete               None      None  dcbfc88a-361f-4a99-bca8-6f300feba34f          True  dcbfc88a-361f-4a99-bca8-6f300feba34f_0             0            0   chirp-v2-xxl-test  [Verse]\\nLost in a world of dreams and fantasy...           None       False  image_dcbfc88a-361f-4a99-bca8-6f300feba34f      False              0           0           0           0                   None\n",
       "2    caefbff9-71f5-471a-bcbe-9fa0892a0771 2023-11-17 06:10:34.771346+00:00 2023-11-17 06:10:34.771350+00:00   66.054147  {'tags': 'trance melodic uplifting', 'prompt':...   163823  complete               None      None  dcbfc88a-361f-4a99-bca8-6f300feba34f          True  dcbfc88a-361f-4a99-bca8-6f300feba34f_1             0            1   chirp-v2-xxl-test  [Verse]\\nLost in a world of dreams and fantasy...           None       False  image_dcbfc88a-361f-4a99-bca8-6f300feba34f      False              0           0           0           0                   None\n",
       "3    147b16a9-078e-43b2-b94d-f5f36acf5b9e 2023-11-17 06:14:30.555494+00:00 2023-11-17 06:14:30.555507+00:00   67.441263  {'tags': 'trance emotional ethereal', 'prompt'...   163823  complete               None      None  e2328f97-3b1d-4e3d-80b8-8bb7a259c208          True  e2328f97-3b1d-4e3d-80b8-8bb7a259c208_0             0            0   chirp-v2-xxl-test  [Verse]\\nLost in her thoughts, she dreams of a...           None       False  image_e2328f97-3b1d-4e3d-80b8-8bb7a259c208      False              0           0           0           0                   None\n",
       "4    117f7bcc-8c8c-4b23-90e2-d0e9207802d7 2023-11-17 06:14:30.555554+00:00 2023-11-17 06:14:30.555558+00:00   67.441263  {'tags': 'trance emotional ethereal', 'prompt'...   163823  complete               None      None  e2328f97-3b1d-4e3d-80b8-8bb7a259c208          True  e2328f97-3b1d-4e3d-80b8-8bb7a259c208_1             0            1   chirp-v2-xxl-test  [Verse]\\nLost in her thoughts, she dreams of a...           None       False  image_e2328f97-3b1d-4e3d-80b8-8bb7a259c208      False              0           0           0           0                   None\n",
       "..                                    ...                              ...                              ...         ...                                                ...      ...       ...                ...       ...                                   ...           ...                                     ...           ...          ...                 ...                                                ...            ...         ...                                         ...        ...            ...         ...         ...         ...              ...   ...\n",
       "754  e8d1d429-fd17-43c9-9761-64179b6f2590 2024-03-22 05:44:57.132125+00:00 2024-03-22 05:44:57.132138+00:00   86.096411  {'tags': 'alt rock, alternative, emo, band, em...   163823  complete               None      None  70f31ff4-2493-40cf-ad50-ed4e933b3290          True    e8d1d429-fd17-43c9-9761-64179b6f2590             0            0   chirp-v3-engine-i  [Intro]\\nLet me tell you 'bout a game I hold\\n...           None       False  image_e8d1d429-fd17-43c9-9761-64179b6f2590      False              0           0           2           0       Axe Dogmas  None\n",
       "755  9861470d-bd55-4ede-9d72-32dbdfe57582 2024-03-22 05:47:06.546553+00:00 2024-03-22 05:47:06.546568+00:00   98.401980  {'tags': 'alt rock, alternative, emo, band, em...   163823  complete               None      None  54b10779-c493-4bd6-bc03-a73b9e4cde6d          True    9861470d-bd55-4ede-9d72-32dbdfe57582             0            0   chirp-v3-engine-i  [Intro]\\nLet me tell you 'bout a game I hold\\n...           None       False  image_9861470d-bd55-4ede-9d72-32dbdfe57582      False              0           0           1           0       Axe Dogmas  None\n",
       "756  17f09fbc-43b7-40c4-8c97-724e60b5b209 2024-03-22 05:47:06.546683+00:00 2024-03-22 05:47:06.546693+00:00  110.533844  {'tags': 'alt rock, alternative, emo, band, em...   163823  complete               None      None  54b10779-c493-4bd6-bc03-a73b9e4cde6d          True    17f09fbc-43b7-40c4-8c97-724e60b5b209             0            1   chirp-v3-engine-i  [Intro]\\nLet me tell you 'bout a game I hold\\n...           None       False  image_17f09fbc-43b7-40c4-8c97-724e60b5b209      False              0           0           1           0       Axe Dogmas  None\n",
       "757  1ee83905-e341-4acb-b3d3-9b4f4eb2cccd 2024-03-22 05:44:40.135345+00:00 2024-03-22 05:44:40.135367+00:00  121.463419  {'tags': 'alt rock, alternative, emo, band, em...   163823  complete               None      None  5e6dc836-bdfb-4125-b0f6-ce8f4de193e1          True    1ee83905-e341-4acb-b3d3-9b4f4eb2cccd             1            0   chirp-v3-engine-i  [Intro]\\nLet me tell you 'bout a game I hold\\n...           None       False  image_1ee83905-e341-4acb-b3d3-9b4f4eb2cccd       True              0           0          10           0       Axe Dogmas  None\n",
       "758  fcb7935e-110d-4ce1-9711-87c36208a4d0 2023-12-27 02:00:11.863564+00:00 2023-12-27 02:00:11.863569+00:00   62.523632  {'tags': '90s R&B, Romantic, Glowing, Sexy, Se...   163823  complete               None      None  41626e6a-117d-4348-a3ea-b97aa0a1afae          True    fcb7935e-110d-4ce1-9711-87c36208a4d0             1            1  chirp-v2-xxl-alpha  [Verse 1]\\nIn the moonlit game, it's a cosmic ...           None       False  image_fcb7935e-110d-4ce1-9711-87c36208a4d0      False              0           0          89           0  Celestial Pulse  None\n",
       "\n",
       "[759 rows x 26 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_generatedclip \n",
    "    where user_id = '163823';\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_trending"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "717e734d",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.192160Z",
     "start_time": "2024-04-17T15:55:21.189784Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2024-03-24 07:49:31.497852+0000', tz='UTC')"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending[\"updated_at\"].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "b60a5240",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.260254Z",
     "start_time": "2024-04-17T15:55:21.193136Z"
    }
   },
   "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>is_generated</th>\n",
       "      <th>s3_id</th>\n",
       "      <th>upvote_count</th>\n",
       "      <th>batch_index</th>\n",
       "      <th>model_name</th>\n",
       "      <th>prompt_text</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",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [id, created_at, updated_at, time_used, metadata, user_id, status, discord_message_id, prompt_id, request_id, is_generated, s3_id, upvote_count, batch_index, model_name, prompt_text, daily_theme_id, is_deleted, image_s3_id, is_public, dislike_count, flag_count, play_count, skip_count, title, slug]\n",
       "Index: []"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending[df_trending[\"title\"].str.contains(\"Can't stop my brain\")]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "78aee02a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "c67d20e6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.430883Z",
     "start_time": "2024-04-17T15:55:21.261265Z"
    }
   },
   "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>password</th>\n",
       "      <th>last_login</th>\n",
       "      <th>is_superuser</th>\n",
       "      <th>username</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>email</th>\n",
       "      <th>is_staff</th>\n",
       "      <th>is_active</th>\n",
       "      <th>date_joined</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>8945308</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>konopqgg@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>konopqgg@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-04-01 22:26:27.786888+00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        id password last_login  is_superuser            username first_name last_name               email  is_staff  is_active                      date_joined\n",
       "0  8945308                None         False  konopqgg@gmail.com                       konopqgg@gmail.com     False       True 2024-04-01 22:26:27.786888+00:00"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "query = \"\"\"select * from auth_user\n",
    "where id = '8945308';\n",
    "\"\"\"\n",
    "user_df = pd.read_sql_query(query, engine)\n",
    "user_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "623f6881",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.536363Z",
     "start_time": "2024-04-17T15:55:21.431928Z"
    }
   },
   "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>password</th>\n",
       "      <th>last_login</th>\n",
       "      <th>is_superuser</th>\n",
       "      <th>username</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>email</th>\n",
       "      <th>is_staff</th>\n",
       "      <th>is_active</th>\n",
       "      <th>date_joined</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>163823</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>a.ohare.94@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>a.ohare.94@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2023-11-17 05:55:10.012251+00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       id password last_login  is_superuser              username first_name last_name                 email  is_staff  is_active                      date_joined\n",
       "0  163823                None         False  a.ohare.94@gmail.com                       a.ohare.94@gmail.com     False       True 2023-11-17 05:55:10.012251+00:00"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "query = \"\"\"select * from auth_user\n",
    "where username = 'a.ohare.94@gmail.com';\n",
    "\"\"\"\n",
    "user_df = pd.read_sql_query(query, engine)\n",
    "user_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "817e42c6",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.641097Z",
     "start_time": "2024-04-17T15:55:21.537360Z"
    }
   },
   "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>password</th>\n",
       "      <th>last_login</th>\n",
       "      <th>is_superuser</th>\n",
       "      <th>username</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>email</th>\n",
       "      <th>is_staff</th>\n",
       "      <th>is_active</th>\n",
       "      <th>date_joined</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>8945308</td>\n",
       "      <td></td>\n",
       "      <td>None</td>\n",
       "      <td>False</td>\n",
       "      <td>konopqgg@gmail.com</td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td>konopqgg@gmail.com</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>2024-04-01 22:26:27.786888+00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        id password last_login  is_superuser            username first_name last_name               email  is_staff  is_active                      date_joined\n",
       "0  8945308                None         False  konopqgg@gmail.com                       konopqgg@gmail.com     False       True 2024-04-01 22:26:27.786888+00:00"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "query = \"\"\"select * from auth_user\n",
    "where id = '8945308';\n",
    "\"\"\"\n",
    "user_df = pd.read_sql_query(query, engine)\n",
    "user_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "c838d724",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:21.743934Z",
     "start_time": "2024-04-17T15:55:21.642155Z"
    }
   },
   "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>relative_index</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>clip_id</th>\n",
       "      <th>playlist_id</th>\n",
       "      <th>updated_by_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2023-11-23 02:08:47.470508+00:00</td>\n",
       "      <td>f5fc4429-b62f-4121-b73b-6028c81879c6</td>\n",
       "      <td>3e1b189c-cc9d-4e67-ab7c-e94717e51dc7</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id  relative_index                       updated_at                               clip_id                           playlist_id  updated_by_id\n",
       "0   1             0.0 2023-11-23 02:08:47.470508+00:00  f5fc4429-b62f-4121-b73b-6028c81879c6  3e1b189c-cc9d-4e67-ab7c-e94717e51dc7             20"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_trending = pd.read_sql_query(\n",
    "    \"\"\"select * from bots_playlistclip \n",
    "    limit 1;\"\"\",\n",
    "    engine,\n",
    ")\n",
    "df_trending.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "d0410a26",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-24T00:22:56.766681Z",
     "start_time": "2024-04-24T00:22:56.668654Z"
    }
   },
   "outputs": [],
   "source": [
    "query = \"\"\"\n",
    "SELECT * FROM bots_userreaction\n",
    "WHERE clip_id = '553776c2-0707-4cc8-85f5-82e104950540';\n",
    "\"\"\"\n",
    "upvoted_df = pd.read_sql_query(query, engine)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "18058731",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-24T00:22:56.917306Z",
     "start_time": "2024-04-24T00:22:56.912328Z"
    }
   },
   "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>play_count</th>\n",
       "      <th>skip_count</th>\n",
       "      <th>flagged</th>\n",
       "      <th>flagged_reason</th>\n",
       "      <th>reaction_type</th>\n",
       "      <th>updated_at</th>\n",
       "      <th>clip_id</th>\n",
       "      <th>user_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>214830228</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>False</td>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>2024-04-23 23:33:30.910419+00:00</td>\n",
       "      <td>553776c2-0707-4cc8-85f5-82e104950540</td>\n",
       "      <td>4619874</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          id  play_count  skip_count  flagged flagged_reason reaction_type                       updated_at                               clip_id  user_id\n",
       "0  214830228           5           0    False           None          None 2024-04-23 23:33:30.910419+00:00  553776c2-0707-4cc8-85f5-82e104950540  4619874"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "upvoted_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "129e3a20",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:22.706971Z",
     "start_time": "2024-04-17T15:55:21.871419Z"
    }
   },
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "'metadata'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "File \u001b[0;32m~/anaconda3/envs/suno_env/lib/python3.10/site-packages/pandas/core/indexes/base.py:3802\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   3801\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 3802\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_engine\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcasted_key\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   3803\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m err:\n",
      "File \u001b[0;32mindex.pyx:153\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
      "File \u001b[0;32mindex.pyx:182\u001b[0m, in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n",
      "File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7081\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
      "File \u001b[0;32mpandas/_libs/hashtable_class_helper.pxi:7089\u001b[0m, in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n",
      "\u001b[0;31mKeyError\u001b[0m: 'metadata'",
      "\nThe above exception was the direct cause of the following exception:\n",
      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[21], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mdf_trending\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmetadata\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m[\u001b[38;5;241m0\u001b[39m])\n",
      "File \u001b[0;32m~/anaconda3/envs/suno_env/lib/python3.10/site-packages/pandas/core/frame.py:4090\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   4088\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcolumns\u001b[38;5;241m.\u001b[39mnlevels \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n\u001b[1;32m   4089\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_getitem_multilevel(key)\n\u001b[0;32m-> 4090\u001b[0m indexer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_loc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m   4091\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_integer(indexer):\n\u001b[1;32m   4092\u001b[0m     indexer \u001b[38;5;241m=\u001b[39m [indexer]\n",
      "File \u001b[0;32m~/anaconda3/envs/suno_env/lib/python3.10/site-packages/pandas/core/indexes/base.py:3809\u001b[0m, in \u001b[0;36mIndex.get_loc\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   3804\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(casted_key, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;129;01mor\u001b[39;00m (\n\u001b[1;32m   3805\u001b[0m         \u001b[38;5;28misinstance\u001b[39m(casted_key, abc\u001b[38;5;241m.\u001b[39mIterable)\n\u001b[1;32m   3806\u001b[0m         \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28many\u001b[39m(\u001b[38;5;28misinstance\u001b[39m(x, \u001b[38;5;28mslice\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m x \u001b[38;5;129;01min\u001b[39;00m casted_key)\n\u001b[1;32m   3807\u001b[0m     ):\n\u001b[1;32m   3808\u001b[0m         \u001b[38;5;28;01mraise\u001b[39;00m InvalidIndexError(key)\n\u001b[0;32m-> 3809\u001b[0m     \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(key) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01merr\u001b[39;00m\n\u001b[1;32m   3810\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m   3811\u001b[0m     \u001b[38;5;66;03m# If we have a listlike key, _check_indexing_error will raise\u001b[39;00m\n\u001b[1;32m   3812\u001b[0m     \u001b[38;5;66;03m#  InvalidIndexError. Otherwise we fall through and re-raise\u001b[39;00m\n\u001b[1;32m   3813\u001b[0m     \u001b[38;5;66;03m#  the TypeError.\u001b[39;00m\n\u001b[1;32m   3814\u001b[0m     \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_check_indexing_error(key)\n",
      "\u001b[0;31mKeyError\u001b[0m: 'metadata'"
     ]
    }
   ],
   "source": [
    "print(df_trending[\"metadata\"][0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2420c64e",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2024-04-17T15:55:22.708112Z",
     "start_time": "2024-04-17T15:55:22.708102Z"
    }
   },
   "outputs": [],
   "source": [
    "print(df_trending[\"metadata\"][0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d339be7e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "suno_env",
   "language": "python",
   "name": "suno_env"
  },
  "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
}
