{"id":2685,"date":"2026-07-26T21:06:57","date_gmt":"2026-07-26T18:06:57","guid":{"rendered":"https:\/\/school.edu-sigma.ru\/blog\/?p=2685"},"modified":"2026-07-26T21:06:57","modified_gmt":"2026-07-26T18:06:57","slug":"sqlite-python-baza-dannyh","status":"publish","type":"post","link":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430"},"content":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c 8 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQLite \u043d\u0430 Python: \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438. \u041f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0435\u0437 SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 fetchall(), fetchone() \u0438 fetchmany(), \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u0430\u043c\u0438 \u0438 \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c SQLite \u0441 Pandas. \u041a\u0430\u0436\u0434\u044b\u0439 \u0448\u0430\u0433 \u2014 \u0441 \u0440\u0430\u0431\u043e\u0447\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043a\u043e\u0434\u0430.<\/p>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u2014 \u043d\u0430 <a style=\"color: #2c6fad; text-decoration: none;\" href=\"https:\/\/docs.python.org\/3\/library\/sqlite3.html\">\u0441\u0430\u0439\u0442\u0435 Python<\/a>.<\/p>\n<h2>SQLite \u0438 \u043c\u043e\u0434\u0443\u043b\u044c sqlite3 \u2014 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f<\/h2>\n<p>SQLite \u2014 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0421\u0423\u0411\u0414 (\u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445): \u0432\u0441\u044f \u0431\u0430\u0437\u0430 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c .db-\u0444\u0430\u0439\u043b\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0451 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u2014 \u0432\u0441\u0435\u0433\u043e, \u0433\u0434\u0435 \u043d\u0443\u0436\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0431\u0430\u0437\u0430 \u0431\u0435\u0437 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. SQLite \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 ACID-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 SQL-\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b.<\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c sqlite3 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 2.5 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 DB-API 2.0 \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u0434\u0440\u0443\u0433\u0438\u0445 \u0421\u0423\u0411\u0414. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 pip \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u0443\u0447\u0438\u0442\u044c Python \u0441 \u043d\u0443\u043b\u044f \u2014 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b? \u041d\u0430 \u043a\u0443\u0440\u0441\u0435 \u00ab\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435: \u0423\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\u00bb \u0448\u043a\u043e\u043b\u044c\u043d\u0438\u043a\u0438 \u0437\u0430 36 \u0447\u0430\u0441\u043e\u0432 \u043e\u0441\u0432\u0430\u0438\u0432\u0430\u044e\u0442 Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043d\u0430 HTML\/CSS\/JavaScript \u0438 Flask, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 Arduino. \u0421 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043d\u044f\u0442\u0438\u044f \u2014 \u043a\u043e\u0434, \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u2014 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 Telegram-\u0431\u043e\u0442. \u0423\u0437\u043d\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 <a style=\"color: #2c6fad; text-decoration: none;\" href=\"https:\/\/school.edu-sigma.ru\/\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u043a\u0443\u0440\u0441\u0430<\/a>.<\/p>\n<p><strong>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u0443\u044e \u0421\u0423\u0411\u0414:<\/strong><\/p>\n<ul>\n<li>SQLite \u2014 \u043e\u0434\u0438\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043e\u0431\u044a\u0451\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435;<\/li>\n<li>MySQL \u2014 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0441 \u0443\u043c\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438;<\/li>\n<li>PostgreSQL \u2014 \u0432\u044b\u0441\u043e\u043a\u0438\u0435 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043e\u0431\u044a\u0451\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442.<\/li>\n<\/ul>\n<p>SQLite \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u044f\u0442\u044c \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<table style=\"width: 100%; border-collapse: collapse; font-size: 14px;\">\n<thead>\n<tr>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u0422\u0438\u043f<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f<br \/>\n<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">NULL<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">None \/ NULL<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">INTEGER<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0426\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e (\u043e\u0442 1 \u0434\u043e 8 \u0431\u0430\u0439\u0442)<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">42, -7, 0<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">REAL<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0427\u0438\u0441\u043b\u043e \u0441 \u043f\u043b\u0430\u0432\u0430\u044e\u0449\u0435\u0439 \u0442\u043e\u0447\u043a\u043e\u0439 (IEEE 754)<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">3.14, 2.0<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">TEXT<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0421\u0442\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF-8<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">&#8216;\u0418\u0432\u0430\u043d&#8217;, &#8216;python&#8217;<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">BLOB<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0444\u0430\u0439\u043b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0412\u0430\u0436\u043d\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c SQLite \u2014 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f (type affinity): \u0442\u0438\u043f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0430. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u0438\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p><strong>Callout:<\/strong> import sqlite3 \u2014 \u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u0430.<\/p>\n<h2>\u0427\u0442\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQLite \u0432 Python<\/h2>\n<p>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b:<\/p>\n<ul>\n<li>Python 3.x \u043b\u044e\u0431\u043e\u0439 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u2014 \u043c\u043e\u0434\u0443\u043b\u044c sqlite3 \u0443\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0451\u043d \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443;<\/li>\n<li>IDE \u0438\u043b\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 (PyCharm, VS Code, IDLE \u2014 \u043b\u044e\u0431\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439);<\/li>\n<li>\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u2014 DB Browser for SQLite (sqlitebrowser.org) \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f .db-\u0444\u0430\u0439\u043b\u043e\u0432 \u0431\u0435\u0437 \u043a\u043e\u0434\u0430.<\/li>\n<\/ul>\n<p>\u0427\u0435\u0433\u043e \u0442\u043e\u0447\u043d\u043e <strong>\u043d\u0435<\/strong> \u043d\u0443\u0436\u043d\u043e: pip install sqlite3, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0435:<\/p>\n<p>python -c &#171;import sqlite3; print(sqlite3.sqlite_version)&#187;<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0440\u043e\u0434\u0435 3.41.2 \u2014 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a SQLite \u043d\u0430 Python \u0433\u043e\u0442\u043e\u0432\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u0448\u0430\u0433\u0443.<\/p>\n<h2>\u041f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 SQLite \u0432 Python<\/h2>\n<p>\u041f\u043e\u043b\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQLite \u043d\u0430 Python \u2014 \u043e\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0430 8 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0441 \u043a\u043e\u0434\u043e\u043c \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1408\" height=\"768\" class=\"aligncenter size-full wp-image-2683\" src=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-vosem.jpg\" alt=\"\u0418\u043d\u0444\u043e\u0433\u0440\u0430\u0444\u0438\u043a\u0430 8 \u0448\u0430\u0433\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQLite \u0432 Python \u2014 \u043b\u0438\u043d\u0435\u0439\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430\" srcset=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-vosem.jpg 1408w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-vosem-300x164.jpg 300w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-vosem-1024x559.jpg 1024w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-vosem-768x419.jpg 768w\" sizes=\"auto, (max-width: 1408px) 100vw, 1408px\" \/><\/p>\n<h3>\u0428\u0430\u0433 1 \u2014 \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1408\" height=\"768\" class=\"aligncenter size-full wp-image-2682\" src=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-soedinenie.jpg\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 SQLite: \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u043a\u0443\u0440\u0441\u043e\u0440, \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432\" srcset=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-soedinenie.jpg 1408w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-soedinenie-300x164.jpg 300w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-soedinenie-1024x559.jpg 1024w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-soedinenie-768x419.jpg 768w\" sizes=\"auto, (max-width: 1408px) 100vw, 1408px\" \/><\/p>\n<p>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 sqlite3.connect(). \u0415\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u2014 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f; \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438.<\/p>\n<p>import sqlite3<\/p>\n<p>conn = sqlite3.connect(&#8216;mydb.db&#8217;) # \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0444\u0430\u0439\u043b mydb.db \u0438\u043b\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e<\/p>\n<p>cur = conn.cursor() # \u043a\u0443\u0440\u0441\u043e\u0440 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/p>\n<p># &#8230; \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 &#8230;<\/p>\n<p>cur.close()<\/p>\n<p>conn.close()<\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u2014 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 with. \u041e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 commit() \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0431\u043b\u043e\u043a\u0430 \u0438 rollback() \u043f\u0440\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435:<\/p>\n<p>import sqlite3<\/p>\n<p>with sqlite3.connect(&#8216;mydb.db&#8217;) as conn:<\/p>\n<p>cur = conn.cursor()<\/p>\n<p># \u0412\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0431\u0430\u0437\u043e\u0439 \u2014 \u0437\u0434\u0435\u0441\u044c<\/p>\n<p># commit() \u0438 close() \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0435\u0437 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a \u2014 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<p>conn = sqlite3.connect(&#8216;:memory:&#8217;) # \u0434\u0430\u043d\u043d\u044b\u0435 \u0436\u0438\u0432\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438<\/p>\n<p>\u041a\u0443\u0440\u0441\u043e\u0440 (cursor) \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041d\u0430 \u043e\u0434\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u0432, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0434\u043d\u043e\u0433\u043e.<\/p>\n<h3>\u0428\u0430\u0433 2 \u2014 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: \u0442\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 DDL-\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h3>\n<p>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 CREATE TABLE. \u0414\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 IF NOT EXISTS \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u2014 \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p>cur.execute(&#171;&#187;&#187;<\/p>\n<p>CREATE TABLE IF NOT EXISTS employees (<\/p>\n<p>id INTEGER PRIMARY KEY AUTOINCREMENT,<\/p>\n<p>name TEXT NOT NULL,<\/p>\n<p>dept TEXT,<\/p>\n<p>salary REAL DEFAULT 0.0,<\/p>\n<p>active INTEGER DEFAULT 1<\/p>\n<p>)<\/p>\n<p>&#171;&#187;&#187;)<\/p>\n<p>conn.commit()<\/p>\n<p>\u0420\u0430\u0437\u0431\u043e\u0440 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b: PRIMARY KEY AUTOINCREMENT \u2014 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 SQLite \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0435. NOT NULL \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043f\u0443\u0441\u0442\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0446\u0435 name. DEFAULT \u0437\u0430\u0434\u0430\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435 \u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438: \u0435\u0441\u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0441 \u0442\u0438\u043f\u043e\u043c INTEGER, SQLite \u043d\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u043a TEXT \u2014 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0432\u0430\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u0438\u043c\u0438 \u0441\u0445\u0435\u043c\u0430\u043c\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 DDL-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (CREATE TABLE, DROP TABLE, ALTER TABLE) \u0432\u044b\u0437\u044b\u0432\u0430\u0439\u0442\u0435 conn.commit() \u2014 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0428\u0430\u0433 3 \u2014 \u0412\u0441\u0442\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: INSERT \u0438 \u043f\u0430\u043a\u0435\u0442\u043d\u0430\u044f \u0432\u0441\u0442\u0430\u0432\u043a\u0430 executemany<\/h3>\n<p>\u0412\u0441\u0442\u0430\u0432\u043a\u0430 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0447\u0435\u0440\u0435\u0437 Prepared Statement (\u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441) \u0441 \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440\u043e\u043c ?:<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;INSERT INTO employees (name, dept, salary) VALUES (?, ?, ?)&#187;,<\/p>\n<p>(&#8216;\u0410\u043d\u043d\u0430&#8217;, &#8216;\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430&#8217;, 120000.0)<\/p>\n<p>)<\/p>\n<p>conn.commit()<\/p>\n<p>\u041f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 ? \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 SQL. \u0421\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u0441 \u0443\u044f\u0437\u0432\u0438\u043c\u044b\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u043c:<\/p>\n<p># \u26a0\ufe0f \u041d\u0415\u0411\u0415\u0417\u041e\u041f\u0410\u0421\u041d\u041e \u2014 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0430\u043a<\/p>\n<p>name = &#171;&#8216; OR &#8216;1&#8217;=&#8217;1&#8243;<\/p>\n<p>cur.execute(f&#187;SELECT * FROM employees WHERE name='{name}'&#187;)<\/p>\n<p># \u0417\u0430\u043f\u0440\u043e\u0441: WHERE name=&#187; OR &#8216;1&#8217;=&#8217;1&#8242; \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438<\/p>\n<p>\u0414\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 executemany() \u2014 \u043e\u043d \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 SQL-\u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439:<\/p>\n<p>new_employees = [<\/p>\n<p>(&#8216;\u0418\u0432\u0430\u043d&#8217;, &#8216;\u0410\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430&#8217;, 95000.0),<\/p>\n<p>(&#8216;\u041c\u0430\u0440\u0438\u044f&#8217;, &#8216;\u0414\u0438\u0437\u0430\u0439\u043d&#8217;, 85000.0),<\/p>\n<p>(&#8216;\u041f\u0451\u0442\u0440&#8217;, &#8216;\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430&#8217;, 130000.0),<\/p>\n<p>(&#8216;\u0415\u043b\u0435\u043d\u0430&#8217;, &#8216;QA&#8217;, 90000.0),<\/p>\n<p>]<\/p>\n<p>cur.executemany(<\/p>\n<p>&#171;INSERT INTO employees (name, dept, salary) VALUES (?, ?, ?)&#187;,<\/p>\n<p>new_employees<\/p>\n<p>)<\/p>\n<p>conn.commit()<\/p>\n<p>executemany() \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0446\u0438\u043a\u043b\u0430 \u0438\u0437 \u0441\u043e\u0442\u0435\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 execute() \u0438 \u0442\u0430\u043a \u0436\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u0435\u043d \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435.<\/p>\n<h3>\u0428\u0430\u0433 4 \u2014 \u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445: SELECT \u0438 \u043c\u0435\u0442\u043e\u0434\u044b fetchone, fetchall, fetchmany<\/h3>\n<p>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 SELECT:<\/p>\n<p>cur.execute(&#171;SELECT * FROM employees&#187;)<\/p>\n<p>\u0422\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432:<\/p>\n<table style=\"width: 100%; border-collapse: collapse; font-size: 14px;\">\n<thead>\n<tr>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041c\u0435\u0442\u043e\u0434<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u0422\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u0430<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430<br \/>\n<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">fetchone()<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u043b\u0438 None<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041e\u0434\u043d\u0430 \u0441\u0442\u0440\u043e\u043a\u0430; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u043d\u0430 None<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">row = cur.fetchone(); if row: &#8230;<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">fetchmany(n)<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041f\u043e\u0440\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">batch = cur.fetchmany(100)<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">fetchall()<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043d\u0430\u0431\u043e\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0446\u0435\u043b\u0438\u043a\u043e\u043c<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">rows = cur.fetchall()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>fetchone() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u0440\u0442\u0435\u0436 \u0438\u043b\u0438 None \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430:<\/p>\n<p>cur.execute(&#171;SELECT name, salary FROM employees WHERE id = ?&#187;, (5,))<\/p>\n<p>row = cur.fetchone()<\/p>\n<p>if row:<\/p>\n<p>print(f&#187;\u0418\u043c\u044f: {row[0]}, \u0417\u0430\u0440\u043f\u043b\u0430\u0442\u0430: {row[1]}&#187;)<\/p>\n<p>else:<\/p>\n<p>print(&#171;\u0417\u0430\u043f\u0438\u0441\u044c \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430&#187;)<\/p>\n<p>fetchall() \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u2014 \u043f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 (\u0442\u044b\u0441\u044f\u0447\u0438 \u0441\u0442\u0440\u043e\u043a \u0438 \u0431\u043e\u043b\u044c\u0448\u0435) \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c fetchmany() \u0438\u043b\u0438 \u0438\u0442\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043a\u0443\u0440\u0441\u043e\u0440\u0443 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e:<\/p>\n<p>cur.execute(&#171;SELECT * FROM employees&#187;)<\/p>\n<p>for row in cur: # \u043f\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0431\u0435\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n<p>print(row)<\/p>\n<p>\u0426\u0438\u043a\u043b \u0441 fetchall() \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432:<\/p>\n<p>rows = cur.fetchall()<\/p>\n<p>for emp in rows:<\/p>\n<p>print(f&#187;{emp[1]} ({emp[2]}): {emp[3]} \u20bd&#187;)<\/p>\n<h3>\u0428\u0430\u0433 5 \u2014 \u0424\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f, \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0438 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>WHERE \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 ?:<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;SELECT name, dept, salary FROM employees WHERE salary &gt; ? ORDER BY salary DESC&#187;,<\/p>\n<p>(100000,)<\/p>\n<p>)<\/p>\n<p>\u0410\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 GROUP BY:<\/p>\n<p>cur.execute(&#171;&#187;&#187;<\/p>\n<p>SELECT dept,<\/p>\n<p>COUNT(*) AS count,<\/p>\n<p>AVG(salary) AS avg_salary,<\/p>\n<p>MIN(salary) AS min_salary,<\/p>\n<p>MAX(salary) AS max_salary<\/p>\n<p>FROM employees<\/p>\n<p>GROUP BY dept<\/p>\n<p>HAVING COUNT(*) &gt;= 2<\/p>\n<p>ORDER BY avg_salary DESC<\/p>\n<p>&#171;&#187;&#187;)<\/p>\n<p>results = cur.fetchall()<\/p>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0430\u0433\u0440\u0435\u0433\u0430\u0442\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: COUNT, SUM, AVG, MIN, MAX. HAVING \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e\u0441\u043b\u0435 GROUP BY \u2014 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 WHERE, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043e \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u043a\u0438.<\/p>\n<p>\u041f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 LIMIT \u0438 OFFSET:<\/p>\n<p>page = 2<\/p>\n<p>per_page = 10<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;SELECT * FROM employees ORDER BY name LIMIT ? OFFSET ?&#187;,<\/p>\n<p>(per_page, (page &#8212; 1) * per_page)<\/p>\n<p>)<\/p>\n<p>BETWEEN \u0434\u043b\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432, LIKE \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, IN \u0434\u043b\u044f \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u2014 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 ?.<\/p>\n<h3>\u0428\u0430\u0433 6 \u2014 \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439<\/h3>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;UPDATE employees SET salary = ?, dept = ? WHERE id = ?&#187;,<\/p>\n<p>(140000.0, &#8216;\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430&#8217;, 1)<\/p>\n<p>)<\/p>\n<p>conn.commit()<\/p>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438:<\/p>\n<p>cur.execute(&#171;DELETE FROM employees WHERE id = ?&#187;, (3,))<\/p>\n<p>conn.commit()<\/p>\n<p>\u26a0\ufe0f <strong>\u041a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e:<\/strong> UPDATE \u0431\u0435\u0437 WHERE \u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. DELETE \u0431\u0435\u0437 WHERE \u0443\u0434\u0430\u043b\u0438\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f. \u041e\u0431\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044e (?); conn.commit() \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0439 DML-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0411\u0435\u0437 commit() \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0438 \u043f\u0440\u043e\u043f\u0430\u0434\u0443\u0442 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0428\u0430\u0433 7 \u2014 \u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 ACID-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1408\" height=\"768\" class=\"aligncenter size-full wp-image-2681\" src=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-tranzaktsiya.jpg\" alt=\"\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 SQLite \u2014 \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043a\u0430\u043a \u0434\u0432\u0430 \u043d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u044b\u0445 \u0448\u0430\u0433\u0430\" srcset=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-tranzaktsiya.jpg 1408w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-tranzaktsiya-300x164.jpg 300w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-tranzaktsiya-1024x559.jpg 1024w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-tranzaktsiya-768x419.jpg 768w\" sizes=\"auto, (max-width: 1408px) 100vw, 1408px\" \/><\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f: \u0431\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u2014 \u0434\u0435\u043d\u044c\u0433\u0438 \u0441\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u0441\u0447\u0451\u0442\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u043d\u0430 \u0441\u0447\u0451\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f. \u042d\u0442\u043e \u0434\u0432\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u043e \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432\u043c\u0435\u0441\u0442\u0435: \u043b\u0438\u0431\u043e \u043e\u0431\u0430, \u043b\u0438\u0431\u043e \u043d\u0438 \u043e\u0434\u043d\u043e. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>ACID-\u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 SQLite:<\/p>\n<ul>\n<li><strong>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c (Atomicity)<\/strong> \u2014 \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0446\u0435\u043b\u0438\u043a\u043e\u043c \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435;<\/li>\n<li><strong>\u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c (Consistency)<\/strong> \u2014 \u0431\u0430\u0437\u0430 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0432 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438;<\/li>\n<li><strong>\u0418\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c (Isolation)<\/strong> \u2014 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043d\u0435 \u0432\u0438\u0434\u044f\u0442 \u043d\u0435\u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430;<\/li>\n<li><strong>\u0414\u043e\u043b\u0433\u043e\u0432\u0435\u0447\u043d\u043e\u0441\u0442\u044c (Durability)<\/strong> \u2014 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u044f \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/li>\n<\/ul>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d 1 \u2014 \u044f\u0432\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 try\/except\/finally:<\/strong><\/p>\n<p>conn = sqlite3.connect(&#8216;mydb.db&#8217;)<\/p>\n<p>try:<\/p>\n<p>cur = conn.cursor()<\/p>\n<p>cur.execute(&#171;UPDATE accounts SET balance = balance &#8212; ? WHERE id = ?&#187;, (5000, 1))<\/p>\n<p>cur.execute(&#171;UPDATE accounts SET balance = balance + ? WHERE id = ?&#187;, (5000, 2))<\/p>\n<p>conn.commit()<\/p>\n<p>except Exception as e:<\/p>\n<p>conn.rollback() # \u043e\u0442\u043a\u0430\u0442 \u0432\u0441\u0435\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435<\/p>\n<p>print(f&#187;\u041e\u0448\u0438\u0431\u043a\u0430: {e}&#187;)<\/p>\n<p>finally:<\/p>\n<p>conn.close()<\/p>\n<p><strong>\u041f\u0430\u0442\u0442\u0435\u0440\u043d 2 \u2014 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 (\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f):<\/strong><\/p>\n<p>with sqlite3.connect(&#8216;mydb.db&#8217;) as conn:<\/p>\n<p>cur = conn.cursor()<\/p>\n<p>cur.execute(&#171;UPDATE accounts SET balance = balance &#8212; ? WHERE id = ?&#187;, (5000, 1))<\/p>\n<p>cur.execute(&#171;UPDATE accounts SET balance = balance + ? WHERE id = ?&#187;, (5000, 2))<\/p>\n<p># commit() \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438; \u043f\u0440\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 rollback()<\/p>\n<p>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u0430\u0436\u043d\u044b \u043f\u0440\u0438 \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u0445 \u0432\u0441\u0442\u0430\u0432\u043a\u0430\u0445, \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<h3>\u0428\u0430\u0433 8 \u2014 \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h3>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u044f: \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u043d\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 \u043a\u043d\u0438\u0433\u0435 \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043b\u0438\u0441\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430 \u043d\u0443\u0436\u043d\u0443\u044e. \u0418\u043d\u0434\u0435\u043a\u0441 \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u0435\u0437 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430:<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;CREATE INDEX IF NOT EXISTS idx_dept ON employees(dept)&#187;<\/p>\n<p>)<\/p>\n<p>conn.commit()<\/p>\n<p>\u0412\u043b\u0438\u044f\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<table style=\"width: 100%; border-collapse: collapse; font-size: 14px;\">\n<thead>\n<tr>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u042d\u0444\u0444\u0435\u043a\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u0430<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439<br \/>\n<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">SELECT + WHERE \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u2705 \u0417\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041f\u043e\u0438\u0441\u043a \u0431\u0435\u0437 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">SELECT + ORDER BY \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u2705 \u0411\u044b\u0441\u0442\u0440\u0435\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0414\u0430\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0438\u043d\u0434\u0435\u043a\u0441\u0435<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">INSERT \/ UPDATE \/ DELETE<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u26a0\ufe0f \u041c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">SQLite \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">\u041c\u0435\u0441\u0442\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u26a0\ufe0f \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0418\u043d\u0434\u0435\u043a\u0441 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u043d\u0434\u0435\u043a\u0441, \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 1 000+ \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438 \u043f\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0443 \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 WHERE \u0438\u043b\u0438 ORDER BY. \u0418\u043d\u0434\u0435\u043a\u0441\u044b \u043d\u0430 \u0432\u0441\u0435\u0445 \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u043f\u043e\u0434\u0440\u044f\u0434 \u2014 \u043b\u0438\u0448\u043d\u0438\u0435: \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0447\u0435\u0440\u0435\u0437 EXPLAIN QUERY PLAN:<\/p>\n<p>cur.execute(<\/p>\n<p>&#171;EXPLAIN QUERY PLAN SELECT * FROM employees WHERE dept = &#8216;\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430'&#187;<\/p>\n<p>)<\/p>\n<p>print(cur.fetchall())<\/p>\n<p># \u0418\u0449\u0438\u0442\u0435 &#8216;USING INDEX&#8217; \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u2014 \u0437\u043d\u0430\u0447\u0438\u0442, \u0438\u043d\u0434\u0435\u043a\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/p>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430:<\/p>\n<p>cur.execute(&#171;DROP INDEX IF EXISTS idx_dept&#187;)<\/p>\n<h2>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438: Views, Triggers \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/h2>\n<p>\u0422\u0440\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432: \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0435\u0441\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438, \u0442\u0440\u0438\u0433\u0433\u0435\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u0443\u044e\u0442 \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 \u043e\u0442 \u0430\u0442\u0430\u043a \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f (Views) \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 (view) \u2014 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430. \u041e\u043d\u043e \u043d\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435, \u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 SQL-\u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438.<\/p>\n<p>cur.execute(&#171;&#187;&#187;<\/p>\n<p>CREATE VIEW IF NOT EXISTS active_developers AS<\/p>\n<p>SELECT id, name, salary<\/p>\n<p>FROM employees<\/p>\n<p>WHERE dept = &#8216;\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430&#8217; AND active = 1<\/p>\n<p>&#171;&#187;&#187;)<\/p>\n<p>conn.commit()<\/p>\n<p># \u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u2014 \u043a\u0430\u043a \u043a \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435<\/p>\n<p>cur.execute(&#171;SELECT * FROM active_developers ORDER BY salary DESC&#187;)<\/p>\n<p>rows = cur.fetchall()<\/p>\n<p>\u0412 SQLite \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f: INSERT, UPDATE \u0438\u043b\u0438 DELETE \u0447\u0435\u0440\u0435\u0437 view \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u2014 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f: \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 JOIN-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0422\u0440\u0438\u0433\u0433\u0435\u0440\u044b (Triggers) \u2014 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u0422\u0440\u0438\u0433\u0433\u0435\u0440 (trigger) \u2014 \u0445\u0440\u0430\u043d\u0438\u043c\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 INSERT, UPDATE \u0438\u043b\u0438 DELETE. \u0421\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430.<\/p>\n<p>cur.execute(&#171;&#187;&#187;<\/p>\n<p>CREATE TRIGGER IF NOT EXISTS log_salary_change<\/p>\n<p>AFTER UPDATE ON employees<\/p>\n<p>WHEN NEW.salary &lt;&gt; OLD.salary<\/p>\n<p>BEGIN<\/p>\n<p>INSERT INTO audit_log (employee_id, old_salary, new_salary, changed_at)<\/p>\n<p>VALUES (OLD.id, OLD.salary, NEW.salary, datetime(&#8216;now&#8217;));<\/p>\n<p>END<\/p>\n<p>&#171;&#187;&#187;)<\/p>\n<p>conn.commit()<\/p>\n<p>\u0422\u0440\u0438\u0433\u0433\u0435\u0440 AFTER UPDATE \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b employees \u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u0438\u0448\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u0440\u043f\u043b\u0430\u0442\u044b \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 audit_log.<\/p>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f: \u0436\u0443\u0440\u043d\u0430\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 (audit log), \u0430\u0432\u0442\u043e\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446, \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f (BEFORE \/ AFTER \u00d7 INSERT \/ UPDATE \/ DELETE) \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0440\u0438\u0433\u0433\u0435\u0440.<\/p>\n<h3>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0437\u0430\u0449\u0438\u0442\u0430 \u043e\u0442 SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0439<\/h3>\n<p>SQL injection (SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u044f) \u2014 \u0430\u0442\u0430\u043a\u0430, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 SQL-\u043a\u043e\u0434 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434. \u041f\u0440\u0438\u043c\u0435\u0440 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<p># \u26a0\ufe0f \u041d\u0415\u0411\u0415\u0417\u041e\u041f\u0410\u0421\u041d\u041e \u2014 f-\u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c<\/p>\n<p>user_login = &#171;admin&#8217; OR &#8216;1&#8217;=&#8217;1&#8243;<\/p>\n<p>cur.execute(f&#187;SELECT * FROM users WHERE login='{user_login}'&#187;)<\/p>\n<p># \u0418\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441: WHERE login=&#8217;admin&#8217; OR &#8216;1&#8217;=&#8217;1&#8242;<\/p>\n<p># \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u043e\u0431\u0445\u043e\u0434 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u043e \u0431\u0435\u0437 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439: <strong>\u0432\u0441\u0435\u0433\u0434\u0430<\/strong> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 ? \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 SQLite (\u0432 MySQL\/PostgreSQL \u2014 %s):<\/p>\n<p># \u2705 \u0411\u0415\u0417\u041e\u041f\u0410\u0421\u041d\u041e \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<p>cur.execute(&#171;SELECT * FROM users WHERE login = ?&#187;, (user_login,))<\/p>\n<p>executemany() \u0442\u043e\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u2014 \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u0435 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0441 \u043d\u0438\u043c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b \u0434\u043b\u044f \u043b\u044e\u0431\u044b\u0445 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h2>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f SQLite \u0441 Pandas \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1408\" height=\"768\" class=\"aligncenter size-full wp-image-2680\" src=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-pandas.jpg\" alt=\"\u0414\u0432\u0443\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043e\u0431\u043c\u0435\u043d \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c\u043e\u043c Pandas \u0438 \u0431\u0430\u0437\u043e\u0439 SQLite\" srcset=\"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-pandas.jpg 1408w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-pandas-300x164.jpg 300w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-pandas-1024x559.jpg 1024w, https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-pandas-768x419.jpg 768w\" sizes=\"auto, (max-width: 1408px) 100vw, 1408px\" \/><\/p>\n<p>Pandas \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u043d\u0435\u0448\u043d\u044f\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0432 \u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e:<\/p>\n<p>pip install pandas<\/p>\n<p><strong>\u0427\u0442\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b SQLite \u0432 DataFrame:<\/strong><\/p>\n<p>import pandas as pd<\/p>\n<p>import sqlite3<\/p>\n<p>conn = sqlite3.connect(&#8216;mydb.db&#8217;)<\/p>\n<p>df = pd.read_sql_query(<\/p>\n<p>&#171;SELECT dept, AVG(salary) AS avg_salary, COUNT(*) AS count FROM employees GROUP BY dept&#187;,<\/p>\n<p>conn<\/p>\n<p>)<\/p>\n<p>print(df)<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0435\u0441\u044c \u0430\u0440\u0441\u0435\u043d\u0430\u043b Pandas: groupby(), merge(), plot(), \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u0431\u0443\u043b\u0435\u0432\u044b\u0435 \u043c\u0430\u0441\u043a\u0438 \u2014 \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e SQL. \u0410\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 df.groupby(&#8216;dept&#8217;).agg(&#8230;) \u0447\u0430\u0441\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b\u0439 SQL \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 JOIN.<\/p>\n<p><strong>\u0417\u0430\u043f\u0438\u0441\u044c DataFrame \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u0432 SQLite:<\/strong><\/p>\n<p># \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043d\u043e\u0432\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/p>\n<p>df_top = df[df[&#8216;avg_salary&#8217;] &gt; 100000]<\/p>\n<p>df_top.to_sql(&#8216;top_departments&#8217;, conn, if_exists=&#8217;replace&#8217;, index=False)<\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 if_exists=&#8217;replace&#8217; \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435; if_exists=&#8217;append&#8217; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439; if_exists=&#8217;fail&#8217; \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0435\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c.<\/p>\n<p>\u0422\u0430\u043a\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c SQLite \u043a\u0430\u043a \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u044c Pandas \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438: \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 .db-\u0444\u0430\u0439\u043b\u0435, \u0430\u043d\u0430\u043b\u0438\u0437 \u2014 \u0432 Python. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u043a\u0430 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u043e\u0432 (pipeline, \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445) \u0431\u0435\u0437 \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0442\u044f\u0436\u0451\u043b\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b.<\/p>\n<h2>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 SQLite \u0432 Python \u0438 \u043a\u0430\u043a \u0438\u0445 \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u0442\u044c<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; font-size: 14px;\">\n<thead>\n<tr>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041e\u0448\u0438\u0431\u043a\u0430<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u041f\u0440\u0438\u0447\u0438\u043d\u0430<br \/>\n<\/strong><\/th>\n<th style=\"padding: 12px 16px; text-align: left; border: 1px solid #ddd; background: #2c2c2c; font-weight: 500; font-size: 13px; color: #ffffff;\"><strong>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<br \/>\n<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">OperationalError: database is locked<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 with; \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 check_same_thread=False \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">OperationalError: no such table<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a .db-\u0444\u0430\u0439\u043b\u0443 \u0438\u043b\u0438 CREATE TABLE \u0435\u0449\u0451 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043f\u0443\u0442\u044c; \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0434\u043e SELECT<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">IntegrityError: NOT NULL constraint failed<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0412\u0441\u0442\u0430\u0432\u043a\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0431\u0435\u0437 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 NOT NULL-\u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432<\/td>\n<\/tr>\n<tr style=\"background: #f9f9f9;\">\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">ProgrammingError: Incorrect number of bindings<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e ? \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043a\u043e\u0440\u0442\u0435\u0436\u0435<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u041f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u0439\u0442\u0435 ? \u0432 SQL \u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u2014 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0441\u0442\u044c<\/td>\n<\/tr>\n<tr>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5; font-weight: 500;\">\u0414\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0417\u0430\u0431\u044b\u0442 conn.commit() \u043f\u043e\u0441\u043b\u0435 INSERT \/ UPDATE \/ DELETE<\/td>\n<td style=\"padding: 12px 16px; border: 1px solid #ddd; line-height: 1.5;\">\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 commit() \u044f\u0432\u043d\u043e \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 with<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u0421\u0430\u043c\u0430\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u0430\u044f \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043f\u043e\u0442\u0435\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0437\u0430\u0431\u044b\u0442\u044b\u0439 conn.commit(). \u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u043b\u043e\u0441\u044c, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043e\u0442\u043a\u0430\u0442\u0438\u043b\u0430\u0441\u044c, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043f\u0430\u043b\u0438. \u041a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 with sqlite3.connect(&#8230;) as conn: \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438: commit \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430, rollback \u2014 \u043f\u0440\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438.<\/p>\n<h2>\u0427\u0430\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b<\/h2>\n<h3>\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c sqlite3 \u0432 Python \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e?<\/h3>\n<p>\u041d\u0435\u0442. \u041c\u043e\u0434\u0443\u043b\u044c sqlite3 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 2.5 \u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Python 3.x. \u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b pip install \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c import sqlite3. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 SQLite \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 python -c &#171;import sqlite3; print(sqlite3.sqlite_version)&#187;.<\/p>\n<h3>\u0413\u0434\u0435 \u043d\u0430\u0439\u0442\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e sqlite3?<\/h3>\n<p>\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 <a style=\"color: #2c6fad; text-decoration: none;\" href=\"https:\/\/docs.python.org\/3\/library\/sqlite3.html\">docs.python.org\/3\/library\/sqlite3.html<\/a> \u2014 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043f\u043e \u0432\u0441\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044f. \u0414\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 SQL \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 sqlite.org\/lang.html. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u0451\u0442 \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432.<\/p>\n<h3>\u0427\u0435\u043c fetchone() \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 fetchall() \u0438 fetchmany()?<\/h3>\n<p>fetchone() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438\u043b\u0438 None \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 None. fetchall() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u2014 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a. fetchmany(n) \u0431\u0435\u0440\u0451\u0442 \u0440\u043e\u0432\u043d\u043e n \u0441\u0442\u0440\u043e\u043a \u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u044c.<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 sqlite3 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043a ? \u0432\u043c\u0435\u0441\u0442\u043e f-\u0441\u0442\u0440\u043e\u043a?<\/h3>\n<p>\u0417\u043d\u0430\u043a ? \u2014 \u044d\u0442\u043e \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (Prepared Statement). Python \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u0443\u044f \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b. F-\u0441\u0442\u0440\u043e\u043a\u0430 f&#187;WHERE name='{val}'&#187; \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u0443\u044f\u0437\u0432\u0438\u043c\u044b\u043c \u043a SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438: \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c &#8216; OR &#8216;1&#8217;=&#8217;1 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u0440\u0430\u0432\u0438\u043b\u043e: \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434 \u0432 SQL \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<h3>\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 executemany() \u0438 \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c?<\/h3>\n<p>cursor.executemany(sql, data) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u0438\u043d SQL-\u0448\u0430\u0431\u043b\u043e\u043d \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0438: \u0432\u043c\u0435\u0441\u0442\u043e \u0446\u0438\u043a\u043b\u0430 \u0441 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 execute() \u2014 \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441 commit() \u0432 \u043a\u043e\u043d\u0446\u0435. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u041f\u0440\u0438\u043c\u0435\u0440: cursor.executemany(&#171;INSERT INTO t VALUES (?,?)&#187;, [(1,&#8217;a&#8217;),(2,&#8217;b&#8217;)]).<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u0442\u044c commit()?<\/h3>\n<p>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u2014 \u0433\u0440\u0443\u043f\u043f\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e: \u043b\u0438\u0431\u043e \u0432\u0441\u0435, \u043b\u0438\u0431\u043e \u043d\u0438 \u043e\u0434\u043d\u0430. \u0411\u0435\u0437 conn.commit() \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0438 \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b .db \u2014 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043e\u043d\u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 try-except-finally \u0441 rollback() \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 with, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 commit \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<h3>\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SQLite, \u0430 \u043d\u0435 MySQL \u0438\u043b\u0438 PostgreSQL?<\/h3>\n<p>SQLite \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. MySQL \u0438 PostgreSQL \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u0438 \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043e\u0431\u044a\u0451\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e SQLite \u2014 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 Python \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.<\/p>\n<h3>\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u00abOperationalError: database is locked\u00bb?<\/h3>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0420\u0435\u0448\u0435\u043d\u0438\u044f: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 with sqlite3.connect(&#8230;) as conn: \u2014 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438; \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 check_same_thread=False; \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e.<\/p>\n<h3>\u041a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c SQLite \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Pandas?<\/h3>\n<p>pd.read_sql_query(&#171;SELECT * FROM table&#187;, conn) \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 SQLite \u0432 DataFrame \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041e\u0431\u0440\u0430\u0442\u043d\u043e: df.to_sql(&#8216;table&#8217;, conn, if_exists=&#8217;replace&#8217;, index=False) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 DataFrame \u0432 SQLite. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c SQL-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Pandas \u0434\u043b\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c commit() \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b SELECT?<\/h3>\n<p>\u041d\u0435\u0442. commit() \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445: INSERT, UPDATE, DELETE, \u0430 \u0442\u0430\u043a\u0436\u0435 CREATE TABLE. \u041f\u043e\u0441\u043b\u0435 SELECT \u043e\u043d \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u2014 \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0437\u044b. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 with sqlite3.connect(&#8230;) as conn: commit \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p><script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntityOfPage\": {\n    \"@type\": \"WebPage\",\n    \"@id\": \"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/\"\n  },\n  \"mainEntity\": [\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c sqlite3 \u0432 Python \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u041d\u0435\u0442. \u041c\u043e\u0434\u0443\u043b\u044c sqlite3 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Python \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 2.5 \u0438 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Python 3.x. \u041d\u0438\u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b pip install \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c import sqlite3. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 SQLite \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 python -c \u00abimport sqlite3; print(sqlite3.sqlite_version)\u00ab.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u0413\u0434\u0435 \u043d\u0430\u0439\u0442\u0438 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e sqlite3?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 docs.python.org\/3\/library\/sqlite3.html \u2014 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043f\u043e \u0432\u0441\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c, \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044f. \u0414\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 SQL \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 sqlite.org\/lang.html. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u0451\u0442 \u0440\u0443\u0441\u0441\u043a\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u0431\u043e\u0440 \u0441 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u0427\u0435\u043c fetchone() \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 fetchall() \u0438 fetchmany()?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"fetchone() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438\u043b\u0438 None \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 None. fetchall() \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u2014 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u044b\u0431\u043e\u0440\u043e\u043a. fetchmany(n) \u0431\u0435\u0440\u0451\u0442 \u0440\u043e\u0432\u043d\u043e n \u0441\u0442\u0440\u043e\u043a \u2014 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0446\u0438\u044f\u043c\u0438 \u0431\u0435\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u044c.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u0417\u0430\u0447\u0435\u043c \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 sqlite3 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u043a ? \u0432\u043c\u0435\u0441\u0442\u043e f-\u0441\u0442\u0440\u043e\u043a?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u0417\u043d\u0430\u043a ? \u2014 \u044d\u0442\u043e \u043f\u043b\u0435\u0439\u0441\u0445\u043e\u043b\u0434\u0435\u0440 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 (Prepared Statement). Python \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u0443\u044f \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b. F-\u0441\u0442\u0440\u043e\u043a\u0430 f\u00abWHERE name='{val}'\u00ab \u0434\u0435\u043b\u0430\u0435\u0442 \u043a\u043e\u0434 \u0443\u044f\u0437\u0432\u0438\u043c\u044b\u043c \u043a SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438: \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c ' OR '1'='1 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u0440\u0430\u0432\u0438\u043b\u043e: \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434 \u0432 SQL \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 executemany() \u0438 \u043a\u043e\u0433\u0434\u0430 \u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"cursor.executemany(sql, data) \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043e\u0434\u0438\u043d SQL-\u0448\u0430\u0431\u043b\u043e\u043d \u043c\u043d\u043e\u0433\u043e\u043a\u0440\u0430\u0442\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0439 \u0432\u0441\u0442\u0430\u0432\u043a\u0438: \u0432\u043c\u0435\u0441\u0442\u043e \u0446\u0438\u043a\u043b\u0430 \u0441 \u0441\u043e\u0442\u043d\u044f\u043c\u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 execute() \u2014 \u043e\u0434\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441 commit() \u0432 \u043a\u043e\u043d\u0446\u0435. \u042d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0435\u0435 \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u041f\u0440\u0438\u043c\u0435\u0440: cursor.executemany(\u00abINSERT INTO t VALUES (?,?)\u00ab, [(1,'a'),(2,'b')]).\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442, \u0435\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u0442\u044c commit()?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u2014 \u0433\u0440\u0443\u043f\u043f\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e: \u043b\u0438\u0431\u043e \u0432\u0441\u0435, \u043b\u0438\u0431\u043e \u043d\u0438 \u043e\u0434\u043d\u0430. \u0411\u0435\u0437 conn.commit() \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0432 \u0431\u0443\u0444\u0435\u0440\u0435 \u0438 \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b .db \u2014 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043e\u043d\u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 try-except-finally \u0441 rollback() \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 with, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 commit \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c SQLite, \u0430 \u043d\u0435 MySQL \u0438\u043b\u0438 PostgreSQL?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"SQLite \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432, \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. MySQL \u0438 PostgreSQL \u043d\u0443\u0436\u043d\u044b \u043f\u0440\u0438 \u0432\u044b\u0441\u043e\u043a\u0438\u0445 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043e\u0431\u044a\u0451\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e SQLite \u2014 \u043d\u0443\u043b\u0435\u0432\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0432 Python \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041a\u0430\u043a \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u00abOperationalError: database is locked\u00bb?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u043a \u0431\u0430\u0437\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e. \u0420\u0435\u0448\u0435\u043d\u0438\u044f: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 with sqlite3.connect(...) as conn: \u2014 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438; \u0434\u043b\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 check_same_thread=False; \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041a\u0430\u043a \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c SQLite \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Pandas?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"pd.read_sql_query(\u00abSELECT * FROM table\u00ab, conn) \u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 SQLite \u0432 DataFrame \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430. \u041e\u0431\u0440\u0430\u0442\u043d\u043e: df.to_sql('table', conn, if_exists='replace', index=False) \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 DataFrame \u0432 SQLite. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0441\u0442\u044c SQL-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Pandas \u0434\u043b\u044f \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438, \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.\"\n      }\n    },\n    {\n      \"@type\": \"Question\",\n      \"name\": \"\u041d\u0443\u0436\u043d\u043e \u043b\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c commit() \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b SELECT?\",\n      \"acceptedAnswer\": {\n        \"@type\": \"Answer\",\n        \"text\": \"\u041d\u0435\u0442. commit() \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445: INSERT, UPDATE, DELETE, \u0430 \u0442\u0430\u043a\u0436\u0435 CREATE TABLE. \u041f\u043e\u0441\u043b\u0435 SELECT \u043e\u043d \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u2014 \u0447\u0442\u0435\u043d\u0438\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0431\u0430\u0437\u044b. \u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 with sqlite3.connect(...) as conn: commit \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 \u0431\u043b\u043e\u043a\u0430, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.\"\n      }\n    }\n  ]\n}\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"singleBlog__desc\">SQLite \u0432 Python \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c sqlite3 \u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 pip \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0411\u0430\u0437\u043e\u0432\u044b\u0439 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b: import sqlite3 \u2192 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u2192 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u2192 SQL-\u0437\u0430\u043f\u0440\u043e\u0441 \u2192 conn.commit().<\/p>\n","protected":false},"author":1,"featured_media":2684,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"cta-position":"main","cta-status":false,"cta-priority":50,"cta-tags":"","id-post-1":0,"id-post-2":0,"id-post-3":0,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-2685","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"admintgu\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"ru_RU\" \/>\n\t\t<meta property=\"og:site_name\" content=\"\u041f\u0440\u043e\u0435\u043a\u0442 \u041a\u043e\u0434 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e -\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-07-26T18:06:57+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-07-26T18:06:57+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b\" \/>\n\t\t<meta name=\"twitter:description\" content=\"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#blogposting\",\"name\":\"\\u0420\\u0430\\u0431\\u043e\\u0442\\u0430 \\u0441 SQLite \\u0432 Python: \\u0441\\u043e\\u0437\\u0434\\u0430\\u043d\\u0438\\u0435 \\u0411\\u0414 \\u0438 SQL-\\u0437\\u0430\\u043f\\u0440\\u043e\\u0441\\u044b\",\"headline\":\"\\u041a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0442\\u044c \\u0441 SQLite \\u0432 Python: \\u043f\\u043e\\u0448\\u0430\\u0433\\u043e\\u0432\\u0430\\u044f \\u0438\\u043d\\u0441\\u0442\\u0440\\u0443\\u043a\\u0446\\u0438\\u044f \\u0441 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440\\u0430\\u043c\\u0438 \\u043a\\u043e\\u0434\\u0430\",\"author\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/author\\\/admintgu\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/sqlite-python-podklyuchenie.jpg\",\"width\":1376,\"height\":768,\"caption\":\"\\u0421\\u0445\\u0435\\u043c\\u0430 \\u043f\\u043e\\u0434\\u043a\\u043b\\u044e\\u0447\\u0435\\u043d\\u0438\\u044f Python \\u043a \\u0431\\u0430\\u0437\\u0435 \\u0434\\u0430\\u043d\\u043d\\u044b\\u0445 SQLite \\u0447\\u0435\\u0440\\u0435\\u0437 \\u0432\\u0441\\u0442\\u0440\\u043e\\u0435\\u043d\\u043d\\u044b\\u0439 \\u043c\\u043e\\u0434\\u0443\\u043b\\u044c\"},\"datePublished\":\"2026-07-26T21:06:57+03:00\",\"dateModified\":\"2026-07-26T21:06:57+03:00\",\"inLanguage\":\"ru-RU\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#webpage\"},\"articleSection\":\"Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/category\\\/python\\\/#listItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/category\\\/python\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#listItem\",\"name\":\"\\u041a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0442\\u044c \\u0441 SQLite \\u0432 Python: \\u043f\\u043e\\u0448\\u0430\\u0433\\u043e\\u0432\\u0430\\u044f \\u0438\\u043d\\u0441\\u0442\\u0440\\u0443\\u043a\\u0446\\u0438\\u044f \\u0441 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440\\u0430\\u043c\\u0438 \\u043a\\u043e\\u0434\\u0430\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#listItem\",\"position\":3,\"name\":\"\\u041a\\u0430\\u043a \\u0440\\u0430\\u0431\\u043e\\u0442\\u0430\\u0442\\u044c \\u0441 SQLite \\u0432 Python: \\u043f\\u043e\\u0448\\u0430\\u0433\\u043e\\u0432\\u0430\\u044f \\u0438\\u043d\\u0441\\u0442\\u0440\\u0443\\u043a\\u0446\\u0438\\u044f \\u0441 \\u043f\\u0440\\u0438\\u043c\\u0435\\u0440\\u0430\\u043c\\u0438 \\u043a\\u043e\\u0434\\u0430\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/category\\\/python\\\/#listItem\",\"name\":\"Python\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/#organization\",\"name\":\"\\u041f\\u0440\\u043e\\u0435\\u043a\\u0442 \\u041a\\u043e\\u0434 \\u0431\\u0443\\u0434\\u0443\\u0449\\u0435\\u0433\\u043e\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/author\\\/admintgu\\\/#author\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/author\\\/admintgu\\\/\",\"name\":\"admintgu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4af8eb1436e15a42550f5f114850884ef54c4368cd86e96a01976abc221195fe?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"admintgu\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#webpage\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/\",\"name\":\"\\u0420\\u0430\\u0431\\u043e\\u0442\\u0430 \\u0441 SQLite \\u0432 Python: \\u0441\\u043e\\u0437\\u0434\\u0430\\u043d\\u0438\\u0435 \\u0411\\u0414 \\u0438 SQL-\\u0437\\u0430\\u043f\\u0440\\u043e\\u0441\\u044b\",\"description\":\"\\u041f\\u043e\\u043b\\u043d\\u0430\\u044f \\u0438\\u043d\\u0441\\u0442\\u0440\\u0443\\u043a\\u0446\\u0438\\u044f \\u043f\\u043e SQLite \\u0432 Python: \\u043f\\u043e\\u0434\\u043a\\u043b\\u044e\\u0447\\u0435\\u043d\\u0438\\u0435, \\u0441\\u043e\\u0437\\u0434\\u0430\\u043d\\u0438\\u0435 \\u0442\\u0430\\u0431\\u043b\\u0438\\u0446, CRUD-\\u043e\\u043f\\u0435\\u0440\\u0430\\u0446\\u0438\\u0438, fetchall\\\/fetchone, \\u0442\\u0440\\u0430\\u043d\\u0437\\u0430\\u043a\\u0446\\u0438\\u0438, \\u0438\\u043d\\u0434\\u0435\\u043a\\u0441\\u044b \\u0438 Pandas. \\u041f\\u0440\\u0438\\u043c\\u0435\\u0440\\u044b \\u043a\\u043e\\u0434\\u0430 \\u043d\\u0430 \\u043a\\u0430\\u0436\\u0434\\u043e\\u043c \\u0448\\u0430\\u0433\\u0435.\",\"inLanguage\":\"ru-RU\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/author\\\/admintgu\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/author\\\/admintgu\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/sqlite-python-podklyuchenie.jpg\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#mainImage\",\"width\":1376,\"height\":768,\"caption\":\"\\u0421\\u0445\\u0435\\u043c\\u0430 \\u043f\\u043e\\u0434\\u043a\\u043b\\u044e\\u0447\\u0435\\u043d\\u0438\\u044f Python \\u043a \\u0431\\u0430\\u0437\\u0435 \\u0434\\u0430\\u043d\\u043d\\u044b\\u0445 SQLite \\u0447\\u0435\\u0440\\u0435\\u0437 \\u0432\\u0441\\u0442\\u0440\\u043e\\u0435\\u043d\\u043d\\u044b\\u0439 \\u043c\\u043e\\u0434\\u0443\\u043b\\u044c\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/sqlite-python-baza-dannyh\\\/#mainImage\"},\"datePublished\":\"2026-07-26T21:06:57+03:00\",\"dateModified\":\"2026-07-26T21:06:57+03:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/\",\"name\":\"\\u041f\\u0440\\u043e\\u0435\\u043a\\u0442 \\u041a\\u043e\\u0434 \\u0431\\u0443\\u0434\\u0443\\u0449\\u0435\\u0433\\u043e\",\"inLanguage\":\"ru-RU\",\"publisher\":{\"@id\":\"https:\\\/\\\/school.edu-sigma.ru\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","description":"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.","canonical_url":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#blogposting","name":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","headline":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430","author":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/author\/admintgu\/#author"},"publisher":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-podklyuchenie.jpg","width":1376,"height":768,"caption":"\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Python \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c"},"datePublished":"2026-07-26T21:06:57+03:00","dateModified":"2026-07-26T21:06:57+03:00","inLanguage":"ru-RU","mainEntityOfPage":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#webpage"},"isPartOf":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#webpage"},"articleSection":"Python"},{"@type":"BreadcrumbList","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog#listItem","position":1,"name":"Home","item":"https:\/\/school.edu-sigma.ru\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/#listItem","name":"Python"}},{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/#listItem","position":2,"name":"Python","item":"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/","nextItem":{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#listItem","name":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430"},"previousItem":{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#listItem","position":3,"name":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430","previousItem":{"@type":"ListItem","@id":"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/#listItem","name":"Python"}}]},{"@type":"Organization","@id":"https:\/\/school.edu-sigma.ru\/blog\/#organization","name":"\u041f\u0440\u043e\u0435\u043a\u0442 \u041a\u043e\u0434 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e","url":"https:\/\/school.edu-sigma.ru\/blog\/"},{"@type":"Person","@id":"https:\/\/school.edu-sigma.ru\/blog\/author\/admintgu\/#author","url":"https:\/\/school.edu-sigma.ru\/blog\/author\/admintgu\/","name":"admintgu","image":{"@type":"ImageObject","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/4af8eb1436e15a42550f5f114850884ef54c4368cd86e96a01976abc221195fe?s=96&d=mm&r=g","width":96,"height":96,"caption":"admintgu"}},{"@type":"WebPage","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#webpage","url":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/","name":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","description":"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.","inLanguage":"ru-RU","isPartOf":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#breadcrumblist"},"author":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/author\/admintgu\/#author"},"creator":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/author\/admintgu\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/school.edu-sigma.ru\/wp-content\/uploads\/2026\/07\/sqlite-python-podklyuchenie.jpg","@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#mainImage","width":1376,"height":768,"caption":"\u0421\u0445\u0435\u043c\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Python \u043a \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 SQLite \u0447\u0435\u0440\u0435\u0437 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c"},"primaryImageOfPage":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/#mainImage"},"datePublished":"2026-07-26T21:06:57+03:00","dateModified":"2026-07-26T21:06:57+03:00"},{"@type":"WebSite","@id":"https:\/\/school.edu-sigma.ru\/blog\/#website","url":"https:\/\/school.edu-sigma.ru\/blog\/","name":"\u041f\u0440\u043e\u0435\u043a\u0442 \u041a\u043e\u0434 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e","inLanguage":"ru-RU","publisher":{"@id":"https:\/\/school.edu-sigma.ru\/blog\/#organization"}}]},"og:locale":"ru_RU","og:site_name":"\u041f\u0440\u043e\u0435\u043a\u0442 \u041a\u043e\u0434 \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e -","og:type":"article","og:title":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","og:description":"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.","og:url":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/","article:published_time":"2026-07-26T18:06:57+00:00","article:modified_time":"2026-07-26T18:06:57+00:00","twitter:card":"summary_large_image","twitter:title":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","twitter:description":"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435."},"aioseo_meta_data":{"post_id":"2685","title":"\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 SQLite \u0432 Python: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0411\u0414 \u0438 SQL-\u0437\u0430\u043f\u0440\u043e\u0441\u044b","description":"\u041f\u043e\u043b\u043d\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e SQLite \u0432 Python: \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446, CRUD-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, fetchall\/fetchone, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 Pandas. \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0448\u0430\u0433\u0435.","keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-07-25 11:27:15","updated":"2026-07-28 00:00:23","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/school.edu-sigma.ru\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/\" title=\"Python\">Python<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/school.edu-sigma.ru\/blog"},{"label":"Python","link":"https:\/\/school.edu-sigma.ru\/blog\/category\/python\/"},{"label":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 SQLite \u0432 Python: \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430","link":"https:\/\/school.edu-sigma.ru\/blog\/sqlite-python-baza-dannyh\/"}],"_links":{"self":[{"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/posts\/2685","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/comments?post=2685"}],"version-history":[{"count":2,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/posts\/2685\/revisions"}],"predecessor-version":[{"id":2697,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/posts\/2685\/revisions\/2697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/media\/2684"}],"wp:attachment":[{"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/media?parent=2685"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/categories?post=2685"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/school.edu-sigma.ru\/blog\/wp-json\/wp\/v2\/tags?post=2685"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}