ManagedkdbInsights/boto/get_database.ipynb (181 lines of code) (raw):

{ "cells": [ { "cell_type": "markdown", "id": "e13084db-c69f-4e70-aa79-acfd2159093a", "metadata": {}, "source": [ "# Get Database" ] }, { "cell_type": "code", "execution_count": 1, "id": "b058c1df-087e-4856-828c-e296ecd1a95c", "metadata": { "tags": [] }, "outputs": [], "source": [ "# just one database\n", "DB_NAME=\"welcomedb\"" ] }, { "cell_type": "code", "execution_count": 2, "id": "3698017d-42ed-4280-afa1-723f19ae398c", "metadata": { "tags": [] }, "outputs": [], "source": [ "import os\n", "import boto3\n", "import json\n", "import datetime\n", "\n", "from managed_kx import *\n", "from env import *" ] }, { "cell_type": "code", "execution_count": 3, "id": "ed241efe-523e-4d2f-8e1b-94a09adf42e7", "metadata": { "tags": [] }, "outputs": [], "source": [ "# Using credentials and create service client\n", "session = boto3.Session()\n", "\n", "# create finspace client\n", "client = session.client(service_name='finspace')" ] }, { "cell_type": "markdown", "id": "6b7294c7-d9a3-4fb2-b671-12ead3e17e83", "metadata": {}, "source": [ "# Database Details" ] }, { "cell_type": "code", "execution_count": 4, "id": "b78cd04a-feb5-4b3b-a8cc-066c5a2e1cf3", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "====================================================================================================\n", "Database: welcomedb, Changesets: \n", "Welcome kdb database\n", "Bytes: 34,526,532 Changesets: 1 Files: 41\n", "----------------------------------------------------------------------------------------------------\n" ] }, { "data": { "text/html": [ "<div>\n", "<style scoped>\n", " .dataframe tbody tr th:only-of-type {\n", " vertical-align: middle;\n", " }\n", "\n", " .dataframe tbody tr th {\n", " vertical-align: top;\n", " }\n", "\n", " .dataframe thead th {\n", " text-align: right;\n", " }\n", "</style>\n", "<table border=\"1\" class=\"dataframe\">\n", " <thead>\n", " <tr style=\"text-align: right;\">\n", " <th></th>\n", " <th>changesetId</th>\n", " <th>createdTimestamp</th>\n", " <th>activeFromTimestamp</th>\n", " <th>lastModifiedTimestamp</th>\n", " <th>status</th>\n", " </tr>\n", " </thead>\n", " <tbody>\n", " <tr>\n", " <th>0</th>\n", " <td>Msm0c8y8XB1k8zYZFNhRug</td>\n", " <td>2024-11-26 14:37:08.859000+00:00</td>\n", " <td>2024-11-26 14:38:01.963000+00:00</td>\n", " <td>2024-11-26 14:38:01.963000+00:00</td>\n", " <td>COMPLETED</td>\n", " </tr>\n", " </tbody>\n", "</table>\n", "</div>" ], "text/plain": [ " changesetId createdTimestamp \\\n", "0 Msm0c8y8XB1k8zYZFNhRug 2024-11-26 14:37:08.859000+00:00 \n", "\n", " activeFromTimestamp lastModifiedTimestamp status \n", "0 2024-11-26 14:38:01.963000+00:00 2024-11-26 14:38:01.963000+00:00 COMPLETED " ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Last Run: 2024-11-26 14:49:56.635909\n" ] } ], "source": [ "dump_database(client, environmentId=ENV_ID, databaseName=DB_NAME)\n", "\n", "print( f\"Last Run: {datetime.datetime.now()}\" )" ] }, { "cell_type": "code", "execution_count": null, "id": "b2292bc6-6089-4fcc-8665-5d02438cd96c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "conda_python3", "language": "python", "name": "conda_python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.15" } }, "nbformat": 4, "nbformat_minor": 5 }