diff --git a/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb b/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb index 811764d..2e214e3 100644 --- a/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb +++ b/examples/jupyter_notebook/YDB SQLAlchemy + Jupyter Notebook Example.ipynb @@ -37,48 +37,25 @@ { "cell_type": "code", "execution_count": 1, + "id": "2d200ccc-c125-4064-897f-4b8d325d23b7", + "metadata": {}, + "outputs": [], + "source": [ + "import warnings\n", + "warnings.filterwarnings('ignore')\n", + "warnings.simplefilter('ignore')" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "1bac5cad-31e1-4dcb-a8c9-5cac24899220", "metadata": { "scrolled": true }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/ovcharuk/work/ydb-python-examples/.venv/lib/python3.9/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Warning: Looks like you're using an outdated `kagglehub` version, please consider updating (latest version: 0.3.4)\n" - ] - }, - { - "data": { - "text/plain": [ - "'/Users/ovcharuk/.cache/kagglehub/datasets/hosammhmdali/mall-customers-dataset/versions/1/Mall_Customers.csv'" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ + "%pip install --upgrade pip --quiet\n", "%pip install kagglehub --quiet\n", "\n", "import kagglehub\n", @@ -90,8 +67,7 @@ "# Retrieve csv file path\n", "dataset_dir = os.listdir(path)\n", "dataset_name = [name for name in dataset_dir if name.endswith(\".csv\")]\n", - "dataset_path = f\"{path}/{dataset_name[0]}\"\n", - "dataset_path" + "dataset_path = f\"{path}/{dataset_name[0]}\"" ] }, { @@ -104,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "380c7989-236f-4714-bf0e-c8d13aa029c0", "metadata": {}, "outputs": [ @@ -112,9 +88,6 @@ "name": "stdout", "output_type": "stream", "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, @@ -200,7 +173,7 @@ "4 5 Female 31 17 40" ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -230,7 +203,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ab8bdc54-9c7a-44b7-84ad-fd39d550799c", "metadata": { "scrolled": true @@ -318,7 +291,7 @@ "4 5 Female 31 17 40" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -368,21 +341,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "224d8411-f2b1-4983-b36f-370a43283f14", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], + "outputs": [], "source": [ "%pip install ydb-sqlalchemy==0.1.3 --quiet" ] @@ -397,32 +359,6 @@ "Skip this part if your YDB installation uses another auth method." ] }, - { - "cell_type": "code", - "execution_count": 5, - "id": "aaa82a4f-adbd-4116-bf77-dec14b5b0d9f", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], - "source": [ - "%pip install yandexcloud --quiet\n", - "\n", - "import json\n", - "sa_json_file_path = \"/Users/ovcharuk/authorized_key.json\"\n", - "with open(sa_json_file_path, 'r') as f:\n", - " sa_json = json.load(f)" - ] - }, { "cell_type": "markdown", "id": "e453c5e4-6c6f-414e-b87c-c9e06bd20a19", @@ -442,17 +378,7 @@ "source": [ "import sqlalchemy as sa\n", "\n", - "args = {\n", - " \"_add_declare_for_yql_stmt_vars\": True,\n", - " \"connect_args\": {\n", - " \"protocol\": \"grpcs\",\n", - " \"credentials\": {\n", - " \"service_account_json\": sa_json\n", - " }\n", - " }\n", - "}\n", - "\n", - "engine = sa.create_engine(\"yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1\", **args)\n", + "engine = sa.create_engine(\"yql+ydb://localhost:2136/local\")\n", "conn = engine.connect()" ] }, @@ -489,7 +415,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -910,21 +836,10 @@ "id": "a7842a2e-247b-4750-9ba1-af1784ccb3ab", "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n", - "I0000 00:00:1732871554.047402 1744191 fork_posix.cc:75] Other threads are currently calling into gRPC, skipping fork() handlers\n" - ] - }, { "name": "stdout", "output_type": "stream", "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", "Note: you may need to restart the kernel to use updated packages.\n" ] }, @@ -974,28 +889,10 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "0ecaaf12-4906-4cc3-a3de-6f59102a439f", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "I0000 00:00:1732871555.087487 1744191 fork_posix.cc:75] Other threads are currently calling into gRPC, skipping fork() handlers\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n", - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", - "Note: you may need to restart the kernel to use updated packages.\n" - ] - } - ], + "outputs": [], "source": [ "%pip install jupysql --quiet\n", "%load_ext sql" @@ -1036,10 +933,10 @@ { "data": { "text/html": [ - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" + "Running query in 'yql+ydb://localhost:2136/local'" ], "text/plain": [ - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" + "Running query in 'yql+ydb://localhost:2136/local'" ] }, "metadata": {}, @@ -1181,10 +1078,10 @@ { "data": { "text/html": [ - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" + "Running query in 'yql+ydb://localhost:2136/local'" ], "text/plain": [ - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" + "Running query in 'yql+ydb://localhost:2136/local'" ] }, "metadata": {}, @@ -1255,7 +1152,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.10.15" } }, "nbformat": 4,