Skip to content

Commit

Permalink
atlas-and-kai db syntax updated
Browse files Browse the repository at this point in the history
  • Loading branch information
demenskyi committed Jan 26, 2024
1 parent 6f68916 commit 773f249
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 6 deletions.
2 changes: 1 addition & 1 deletion notebooks/atlas-and-kai/meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ description="""\
Run your MongoDB queries on SingleStore Kai with no code change. \
"""
icon="database"
tags=["mongodb", "kai"]
tags=["starter", "mongo", "kai"]
destinations=["spaces"]
69 changes: 64 additions & 5 deletions notebooks/atlas-and-kai/notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@
"</div>"
]
},
{
"cell_type": "markdown",
"id": "df80b45e",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Note</b></p>\n",
" <p> This notebook can be run on a Free Starter Workspace. To create a Free Starter Workspace navigate to <tt>Start</tt> using the left nav. You can also use your existing Standard or Premium workspace with this Notebook. </p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "ca93a410-d513-42ec-a823-99ad8f3a25c1",
Expand Down Expand Up @@ -64,7 +78,7 @@
"source": [
"**Make sure that you have a created MongoDB enabled workspace.**\n",
"\n",
"This must be done when creating a workspace."
"This must be done when creating a workspace (for Standard/Premium Workspaces) For Starter Workspaces, the KAI API will be on by default."
]
},
{
Expand All @@ -85,15 +99,45 @@
"!pip install pymongo pandas matplotlib plotly ipywidgets --quiet"
]
},
{
"cell_type": "markdown",
"id": "7016efcd",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p> If you have a Free Starter Workspace deployed already, select the database from drop-down menu at the top of this notebook. It updates the <tt>connection_url</tt> to connect to that database.</p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "6087e187-ab0b-4df6-8c9e-ee9fc7153a6b",
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"DROP DATABASE IF EXISTS new_transactions"
"shared_tier_check = %sql show variables like 'is_shared_tier'\n",
"if not shared_tier_check or shared_tier_check[0][1] == 'OFF':\n",
" %sql DROP DATABASE IF EXISTS new_transactions;\n",
" %sql CREATE DATABASE new_transactions;"
]
},
{
"cell_type": "markdown",
"id": "27a6f491",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p> Make sure to select a database from the drop-down menu at the top of this notebook. It updates the <tt>connection_url</tt> to connect to that database.</p>\n",
" </div>\n",
"</div>"
]
},
{
Expand Down Expand Up @@ -682,15 +726,30 @@
"## Clean up"
]
},
{
"cell_type": "markdown",
"id": "15754544",
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-warning\">\n",
" <b class=\"fa fa-solid fa-exclamation-circle\"></b>\n",
" <div>\n",
" <p><b>Action Required</b></p>\n",
" <p> If you created a new database in your Standard or Premium Workspace, you can drop the database by running the cell below. Note: this will not drop your database for Free Starter Workspaces. To drop a Free Starter Workspace, terminate the Workspace using the UI. </p>\n",
" </div>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "40e2ed0b-9b43-446a-9150-823b8e87dd0d",
"metadata": {},
"outputs": [],
"source": [
"%%sql\n",
"DROP DATABASE IF EXISTS new_transactions"
"shared_tier_check = %sql show variables like 'is_shared_tier'\n",
"if not shared_tier_check or shared_tier_check[0][1] == 'OFF':\n",
" %sql DROP DATABASE IF EXISTS new_transactions;"
]
},
{
Expand Down

0 comments on commit 773f249

Please sign in to comment.