|
37 | 37 | { |
38 | 38 | "cell_type": "code", |
39 | 39 | "execution_count": 1, |
| 40 | + "id": "2d200ccc-c125-4064-897f-4b8d325d23b7", |
| 41 | + "metadata": {}, |
| 42 | + "outputs": [], |
| 43 | + "source": [ |
| 44 | + "import warnings\n", |
| 45 | + "warnings.filterwarnings('ignore')\n", |
| 46 | + "warnings.simplefilter('ignore')" |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + "cell_type": "code", |
| 51 | + "execution_count": null, |
40 | 52 | "id": "1bac5cad-31e1-4dcb-a8c9-5cac24899220", |
41 | 53 | "metadata": { |
42 | 54 | "scrolled": true |
43 | 55 | }, |
44 | | - "outputs": [ |
45 | | - { |
46 | | - "name": "stdout", |
47 | | - "output_type": "stream", |
48 | | - "text": [ |
49 | | - "\n", |
50 | | - "\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", |
51 | | - "\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", |
52 | | - "Note: you may need to restart the kernel to use updated packages.\n" |
53 | | - ] |
54 | | - }, |
55 | | - { |
56 | | - "name": "stderr", |
57 | | - "output_type": "stream", |
58 | | - "text": [ |
59 | | - "/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", |
60 | | - " from .autonotebook import tqdm as notebook_tqdm\n" |
61 | | - ] |
62 | | - }, |
63 | | - { |
64 | | - "name": "stdout", |
65 | | - "output_type": "stream", |
66 | | - "text": [ |
67 | | - "Warning: Looks like you're using an outdated `kagglehub` version, please consider updating (latest version: 0.3.4)\n" |
68 | | - ] |
69 | | - }, |
70 | | - { |
71 | | - "data": { |
72 | | - "text/plain": [ |
73 | | - "'/Users/ovcharuk/.cache/kagglehub/datasets/hosammhmdali/mall-customers-dataset/versions/1/Mall_Customers.csv'" |
74 | | - ] |
75 | | - }, |
76 | | - "execution_count": 1, |
77 | | - "metadata": {}, |
78 | | - "output_type": "execute_result" |
79 | | - } |
80 | | - ], |
| 56 | + "outputs": [], |
81 | 57 | "source": [ |
| 58 | + "%pip install --upgrade pip --quiet\n", |
82 | 59 | "%pip install kagglehub --quiet\n", |
83 | 60 | "\n", |
84 | 61 | "import kagglehub\n", |
|
90 | 67 | "# Retrieve csv file path\n", |
91 | 68 | "dataset_dir = os.listdir(path)\n", |
92 | 69 | "dataset_name = [name for name in dataset_dir if name.endswith(\".csv\")]\n", |
93 | | - "dataset_path = f\"{path}/{dataset_name[0]}\"\n", |
94 | | - "dataset_path" |
| 70 | + "dataset_path = f\"{path}/{dataset_name[0]}\"" |
95 | 71 | ] |
96 | 72 | }, |
97 | 73 | { |
|
104 | 80 | }, |
105 | 81 | { |
106 | 82 | "cell_type": "code", |
107 | | - "execution_count": 2, |
| 83 | + "execution_count": 3, |
108 | 84 | "id": "380c7989-236f-4714-bf0e-c8d13aa029c0", |
109 | 85 | "metadata": {}, |
110 | 86 | "outputs": [ |
111 | 87 | { |
112 | 88 | "name": "stdout", |
113 | 89 | "output_type": "stream", |
114 | 90 | "text": [ |
115 | | - "\n", |
116 | | - "\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", |
117 | | - "\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", |
118 | 91 | "Note: you may need to restart the kernel to use updated packages.\n" |
119 | 92 | ] |
120 | 93 | }, |
|
200 | 173 | "4 5 Female 31 17 40" |
201 | 174 | ] |
202 | 175 | }, |
203 | | - "execution_count": 2, |
| 176 | + "execution_count": 3, |
204 | 177 | "metadata": {}, |
205 | 178 | "output_type": "execute_result" |
206 | 179 | } |
|
230 | 203 | }, |
231 | 204 | { |
232 | 205 | "cell_type": "code", |
233 | | - "execution_count": 3, |
| 206 | + "execution_count": 4, |
234 | 207 | "id": "ab8bdc54-9c7a-44b7-84ad-fd39d550799c", |
235 | 208 | "metadata": { |
236 | 209 | "scrolled": true |
|
318 | 291 | "4 5 Female 31 17 40" |
319 | 292 | ] |
320 | 293 | }, |
321 | | - "execution_count": 3, |
| 294 | + "execution_count": 4, |
322 | 295 | "metadata": {}, |
323 | 296 | "output_type": "execute_result" |
324 | 297 | } |
|
368 | 341 | }, |
369 | 342 | { |
370 | 343 | "cell_type": "code", |
371 | | - "execution_count": 4, |
| 344 | + "execution_count": null, |
372 | 345 | "id": "224d8411-f2b1-4983-b36f-370a43283f14", |
373 | 346 | "metadata": {}, |
374 | | - "outputs": [ |
375 | | - { |
376 | | - "name": "stdout", |
377 | | - "output_type": "stream", |
378 | | - "text": [ |
379 | | - "\n", |
380 | | - "\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", |
381 | | - "\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", |
382 | | - "Note: you may need to restart the kernel to use updated packages.\n" |
383 | | - ] |
384 | | - } |
385 | | - ], |
| 347 | + "outputs": [], |
386 | 348 | "source": [ |
387 | 349 | "%pip install ydb-sqlalchemy==0.1.3 --quiet" |
388 | 350 | ] |
|
397 | 359 | "Skip this part if your YDB installation uses another auth method." |
398 | 360 | ] |
399 | 361 | }, |
400 | | - { |
401 | | - "cell_type": "code", |
402 | | - "execution_count": 5, |
403 | | - "id": "aaa82a4f-adbd-4116-bf77-dec14b5b0d9f", |
404 | | - "metadata": {}, |
405 | | - "outputs": [ |
406 | | - { |
407 | | - "name": "stdout", |
408 | | - "output_type": "stream", |
409 | | - "text": [ |
410 | | - "\n", |
411 | | - "\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", |
412 | | - "\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", |
413 | | - "Note: you may need to restart the kernel to use updated packages.\n" |
414 | | - ] |
415 | | - } |
416 | | - ], |
417 | | - "source": [ |
418 | | - "%pip install yandexcloud --quiet\n", |
419 | | - "\n", |
420 | | - "import json\n", |
421 | | - "sa_json_file_path = \"/Users/ovcharuk/authorized_key.json\"\n", |
422 | | - "with open(sa_json_file_path, 'r') as f:\n", |
423 | | - " sa_json = json.load(f)" |
424 | | - ] |
425 | | - }, |
426 | 362 | { |
427 | 363 | "cell_type": "markdown", |
428 | 364 | "id": "e453c5e4-6c6f-414e-b87c-c9e06bd20a19", |
|
442 | 378 | "source": [ |
443 | 379 | "import sqlalchemy as sa\n", |
444 | 380 | "\n", |
445 | | - "args = {\n", |
446 | | - " \"_add_declare_for_yql_stmt_vars\": True,\n", |
447 | | - " \"connect_args\": {\n", |
448 | | - " \"protocol\": \"grpcs\",\n", |
449 | | - " \"credentials\": {\n", |
450 | | - " \"service_account_json\": sa_json\n", |
451 | | - " }\n", |
452 | | - " }\n", |
453 | | - "}\n", |
454 | | - "\n", |
455 | | - "engine = sa.create_engine(\"yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1\", **args)\n", |
| 381 | + "engine = sa.create_engine(\"yql+ydb://localhost:2136/local\")\n", |
456 | 382 | "conn = engine.connect()" |
457 | 383 | ] |
458 | 384 | }, |
|
489 | 415 | { |
490 | 416 | "data": { |
491 | 417 | "text/plain": [ |
492 | | - "<sqlalchemy.engine.cursor.CursorResult at 0x12001d340>" |
| 418 | + "<sqlalchemy.engine.cursor.CursorResult at 0x10b035600>" |
493 | 419 | ] |
494 | 420 | }, |
495 | 421 | "execution_count": 7, |
|
910 | 836 | "id": "a7842a2e-247b-4750-9ba1-af1784ccb3ab", |
911 | 837 | "metadata": {}, |
912 | 838 | "outputs": [ |
913 | | - { |
914 | | - "name": "stderr", |
915 | | - "output_type": "stream", |
916 | | - "text": [ |
917 | | - "WARNING: All log messages before absl::InitializeLog() is called are written to STDERR\n", |
918 | | - "I0000 00:00:1732871554.047402 1744191 fork_posix.cc:75] Other threads are currently calling into gRPC, skipping fork() handlers\n" |
919 | | - ] |
920 | | - }, |
921 | 839 | { |
922 | 840 | "name": "stdout", |
923 | 841 | "output_type": "stream", |
924 | 842 | "text": [ |
925 | | - "\n", |
926 | | - "\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", |
927 | | - "\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", |
928 | 843 | "Note: you may need to restart the kernel to use updated packages.\n" |
929 | 844 | ] |
930 | 845 | }, |
|
974 | 889 | }, |
975 | 890 | { |
976 | 891 | "cell_type": "code", |
977 | | - "execution_count": 12, |
| 892 | + "execution_count": null, |
978 | 893 | "id": "0ecaaf12-4906-4cc3-a3de-6f59102a439f", |
979 | 894 | "metadata": {}, |
980 | | - "outputs": [ |
981 | | - { |
982 | | - "name": "stderr", |
983 | | - "output_type": "stream", |
984 | | - "text": [ |
985 | | - "I0000 00:00:1732871555.087487 1744191 fork_posix.cc:75] Other threads are currently calling into gRPC, skipping fork() handlers\n" |
986 | | - ] |
987 | | - }, |
988 | | - { |
989 | | - "name": "stdout", |
990 | | - "output_type": "stream", |
991 | | - "text": [ |
992 | | - "\n", |
993 | | - "\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", |
994 | | - "\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", |
995 | | - "Note: you may need to restart the kernel to use updated packages.\n" |
996 | | - ] |
997 | | - } |
998 | | - ], |
| 895 | + "outputs": [], |
999 | 896 | "source": [ |
1000 | 897 | "%pip install jupysql --quiet\n", |
1001 | 898 | "%load_ext sql" |
|
1036 | 933 | { |
1037 | 934 | "data": { |
1038 | 935 | "text/html": [ |
1039 | | - "<span style=\"None\">Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'</span>" |
| 936 | + "<span style=\"None\">Running query in 'yql+ydb://localhost:2136/local'</span>" |
1040 | 937 | ], |
1041 | 938 | "text/plain": [ |
1042 | | - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" |
| 939 | + "Running query in 'yql+ydb://localhost:2136/local'" |
1043 | 940 | ] |
1044 | 941 | }, |
1045 | 942 | "metadata": {}, |
|
1181 | 1078 | { |
1182 | 1079 | "data": { |
1183 | 1080 | "text/html": [ |
1184 | | - "<span style=\"None\">Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'</span>" |
| 1081 | + "<span style=\"None\">Running query in 'yql+ydb://localhost:2136/local'</span>" |
1185 | 1082 | ], |
1186 | 1083 | "text/plain": [ |
1187 | | - "Running query in 'yql+ydb://ydb.serverless.yandexcloud.net:2135//ru-central1/b1g8skpblkos03malf3s/etnkr25d1qgm50un6sl1'" |
| 1084 | + "Running query in 'yql+ydb://localhost:2136/local'" |
1188 | 1085 | ] |
1189 | 1086 | }, |
1190 | 1087 | "metadata": {}, |
|
1255 | 1152 | "name": "python", |
1256 | 1153 | "nbconvert_exporter": "python", |
1257 | 1154 | "pygments_lexer": "ipython3", |
1258 | | - "version": "3.9.19" |
| 1155 | + "version": "3.10.15" |
1259 | 1156 | } |
1260 | 1157 | }, |
1261 | 1158 | "nbformat": 4, |
|
0 commit comments