{"id":360255,"date":"2024-05-21T00:49:34","date_gmt":"2024-05-21T00:49:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360255"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360255","title":{"rendered":"<span>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043f\u043e \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b\u0443 \u0438 \u0441\u0442\u0440\u043e\u0438\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0434\u0438\u043c \u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u0443\u00a0\u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0432\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435. \u041a\u0430\u043a\u00a0\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0435 \u0441\u0435\u0431\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u2011\u0430\u0434\u043c\u0438\u043d\u044b, \u044f \u0445\u043e\u0447\u0443 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430\u00a0\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439: \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0447\u0442\u043e\u2011\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c\/\u043e\u0442\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>\u0412\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435 \u0438\u0437\u00a0\u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435\u2011\u0442\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u041d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a0\u0434\u043d\u044f, \u0447\u0442\u043e\u00a0\u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 drill down \u0434\u043e\u00a0\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f. <\/p>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043a\u0430\u043a\u00a0\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 API \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0438 \u043a\u0430\u043a\u00a0\u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432: YDB \u0432\u00a0\u0440\u0435\u0436\u0438\u043c\u0435 serverless \u0438 DataLens. <\/p>\n<h2>1. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e as is<\/h2>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a69\/30b\/a6e\/a6930ba6e9ea2061dc227f772f265c24.png\" alt=\"\u0412\u0438\u0434\u0438\u043c \u0434\u0430\u0442\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0451.\" title=\"\u0412\u0438\u0434\u0438\u043c \u0434\u0430\u0442\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0451.\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a69\/30b\/a6e\/a6930ba6e9ea2061dc227f772f265c24.png\"\/><\/p>\n<div><figcaption>\u0412\u0438\u0434\u0438\u043c \u0434\u0430\u0442\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0451.<\/figcaption><\/div>\n<\/figure>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u0442\u0430\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u0435\u00a0\u0436\u0435 \u043e\u0442\u043f\u0438\u0441\u043a\u0438 \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f\u00a0\u2014 \u0438\u0445 \u0432\u00a0\u0442\u0430\u043a\u043e\u043c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u041d\u043e\u00a0\u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 API \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0430\u043c\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0430, \u043f\u043e\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0448\u0451\u043b \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a).<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0449\u0451 \u0432\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u0435\u043d\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432\u00a0\u0441\u0432\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u044f \u0437\u0430\u0433\u043e\u0440\u0435\u043b\u0441\u044f \u0438\u0434\u0435\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u00a0Python: \u043e\u043d \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u00a0\u0430\u0434\u043c\u0438\u043d\u2011\u043f\u0440\u0430\u0432\u0430\u043c\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b \u0438\u0445 \u0432\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u00a0\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0440\u044f\u0434\u043e\u043c. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9c7\/f1d\/a64\/9c7f1da64533baa21990719d45f67ca5.png\" alt=\"\u0421\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f.\" title=\"\u0421\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f.\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9c7\/f1d\/a64\/9c7f1da64533baa21990719d45f67ca5.png\"\/><\/p>\n<div><figcaption>\u0421\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f.<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430, \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0432\u00a0\u043a\u0430\u043a\u043e\u043c\u2011\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>.stringify()<\/code>  \u0432\u00a0telethon, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u043b \u0442\u0430\u043a\u0438\u043c \u00ab\u0447\u0451\u0440\u043d\u044b\u043c \u044f\u0449\u0438\u043a\u043e\u043c\u00bb. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6cf\/b0a\/3ff\/6cfb0a3ff545037fe793a7af17acfc53.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f.\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f.\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6cf\/b0a\/3ff\/6cfb0a3ff545037fe793a7af17acfc53.png\"\/><\/p>\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/figcaption><\/div>\n<\/figure>\n<p>\u042d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0431\u044b\u043b \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0438 \u043f\u0440\u0438\u0432\u0451\u043b \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043b \u0438 \u043f\u043e\u0448\u0451\u043b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0438\u0434\u0435\u044e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>2. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f  <\/h2>\n<p>\u0414\u043b\u044f\u00a0\u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0432\u044b\u0431\u0440\u0430\u043b Go \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<a href=\"https:\/\/github.com\/gotd\/td\"> <u>gotd<\/u><\/a>, \u043a\u0430\u043a\u00a0\u0441\u0430\u043c\u0443\u044e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0443\u044e \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0443\u044e. <\/p>\n<p>\u0412\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u043c\u044b \u0440\u0430\u0437 \u0432\u00a0\u043c\u0438\u043d\u0443\u0442\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437\u00a0\u043d\u0438\u0445, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u00a0\u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"go\">func main() { \/\/ init  go AdminLogUpdater(ctx, time.Minute, channelID) }  func AdminLogUpdater(ctx context.Context, interval time.Duration, channelID int64) { ticker := time.NewTicker(interval) defer ticker.Stop()  for { err := updateAdminLog(ctx, channelID) if err != nil { \/\/ logging }  select { case &lt;-ticker.C: continue case &lt;-ctx.Done(): return } } }  func updateAdminLog(ctx context.Context, channelID int64) error { resp, err := GetChannelAdminLog(ctx, channelID) if err != nil { return err }  storage.AddEvents(resp.Events) storage.AddUsers(resp.Users)  return nil }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u043a\u0440\u044b\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u00a0telethon, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0435\u043b\u0430\u043b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u0438 \u043d\u0435\u00a0\u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b. \u0422\u0430\u043a \u0447\u0442\u043e\u00a0\u043a\u043e\u0434\u0430 \u0434\u043b\u044f\u00a0gotd \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435. <\/p>\n<h3>\u041f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c: \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f  <\/h3>\n<p>\u0412\u00a0Telegram \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432.<\/p>\n<ol>\n<li>\n<p>\u0411\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c @BotFather \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0434\u0430\u0435\u0442 ID \u0438 \u0442\u043e\u043a\u0435\u043d. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u00a0URL, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a<a href=\"https:\/\/core.telegram.org\/bots\/api\"> <u>Bot API<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u044e\u0437\u0435\u0440\u044b \u0441\u00a0\u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043b\u044f\u00a0\u043d\u0435\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u0435\u043d \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0430\u00a0\u043f\u043e\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u043a\u0442\u043e\u0440: \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434\u00a0\u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u0443\u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e,\u00a0\u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 SMS.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0435\u0439 \u043d\u0435\u00a0\u0432\u044b\u0439\u0434\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u00a0\u0434\u0432\u0443\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0435\u0451 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442. \u0422\u0430\u043a\u0436\u0435 \u0443\u00a0\u043d\u0435\u0451 \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c\u0430 \u0441\u0442\u0430\u0442\u044c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430\u00a0\u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0432\u00a0\u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u0414\u0430\u00a0\u0438 \u043a\u0430\u043a\u0438\u0435\u2011\u0442\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u043b\u0438\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u0431\u043e\u0442\u0430.<\/p>\n<h3>\u0412\u0442\u043e\u0440\u0430\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c: \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 AccessHash<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e\u2011\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431\u00a0\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \u0438\u043b\u0438\u00a0\u0447\u0430\u0442\u0435, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c AccessHash\u00a0\u2014 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430\u00a0\u043b\u0438\u043d\u043a\u0435\u0440 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0415\u0433\u043e \u0434\u0430\u044e\u0442, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0451\u043b \u043a\u043e\u043d\u043d\u0435\u043a\u0442: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u00a0\u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u00a0\u043a\u0430\u043d\u0430\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430\u00a0\u0438\u043c\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432\u00a0\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044c. <\/p>\n<p>\u041a\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0410\u00a0\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043a\u0430\u043d\u0430\u043b X, \u0442\u043e \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d AccessHash = 123. \u0410\u00a0\u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0411 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043a\u0430\u043d\u0430\u043b X, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d AccessHash = 456. \u0418 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0411 \u0437\u0430\u0432\u043b\u0430\u0434\u0435\u0435\u0442 AccessHash, \u044d\u0442\u043e \u043d\u0435\u00a0\u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0435\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 \u0410, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u2011\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u044d\u0448 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c. <\/p>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438: \u0438\u043d\u0430\u0447\u0435 \u043c\u043e\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0430\u043d\u0430\u043b\u044b \u0438 \u0447\u0430\u0442\u044b \u0432\u00a0\u0446\u0438\u043a\u043b\u0435, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f\u00a0\u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u043f\u0430\u043c\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e\u2011\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u00a0\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u0445\u044d\u0448.<\/p>\n<p>\u0412\u00a0telethon \u044d\u0442\u0438 \u0445\u044d\u0448\u0438\u00a0\u0431\u044b\u043b\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u044b, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u00a0\u0431\u0430\u0437\u0435 SQLite \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u0430\u043c\u0438. \u0412\u00a0\u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 AccessHash \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c, \u0447\u0442\u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u00ab\u0437\u043d\u0430\u043a\u043e\u043c\u00bb \u0441\u00a0\u043d\u0430\u043c\u0438 \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u00a0\u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u00a0\u043d\u0430\u0448\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u043e\u043c. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0442\u043e AccessHash \u0434\u043e\u043b\u0436\u0435\u043d\u00a0\u0431\u044b\u0442\u044c \u043f\u043e\u0434\u00a0\u0440\u0443\u043a\u043e\u0439.\u00a0<\/p>\n<h2>3. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439  <\/h2>\n<p>\u0414\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Serverless YDB \u0432\u00a0Yandex Cloud\u00a0\u2014 \u0438 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u00a0\u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0443 \u043f\u043e\u0434\u0430\u0440\u0438\u043b\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e pet\u2011\u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u00a0\u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u044b\u0431\u0438\u0440\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u043e\u00a0\u0446\u0435\u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<br \/>\u0412\u00a0serverless\u2011\u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u043b\u044f\u00a0\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u00a0\u043d\u0443\u0436\u0435\u043d \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440, \u0430\u00a0\u0442\u0430\u0440\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u00a0\u0443\u0447\u0451\u0442\u043e\u043c\u00a0\u043b\u0438\u043c\u0438\u0442\u043e\u0432, \u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u00a0\u043c\u0435\u0441\u044f\u0446 \u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c\u0438, \u044d\u0442\u0438\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u0435\u0437\u00a0\u0431\u044e\u0434\u0436\u0435\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0432\u00a0\u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u043b\u044f\u00a0\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00a0\u2014 \u0432\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043d\u0435\u00a0\u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0\u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u043d\u043e\u00a0\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/cloud.yandex.ru\/docs\/ydb\/security\/\"><u>\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u00a0\u0442\u0435\u043c\u0435<\/u><\/a>. <\/p>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u0414\u043b\u044f\u00a0\u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0443\u043c\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e: ID, AccessHash, \u0438\u043c\u044f (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439). \u041f\u0440\u0438\u00a0\u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u043b\u0430\u0432\u043d\u043e\u0435,\u00a0\u2014 \u043e\u043f\u044f\u0442\u044c\u00a0\u0436\u0435, \u043d\u0435\u00a0\u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e <a href=\"https:\/\/cloud.yandex.ru\/security\/data-privacy\"><u>\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0438\u043c ID, \u0432\u0440\u0435\u043c\u044f, ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0432\u0441\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u00a0\u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e\u00a0golang\u2011migrate \u043d\u0435\u00a0\u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0YDB (\u0435\u0441\u043b\u0438 \u043a\u0442\u043e\u2011\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u0435, \u0438 \u044f \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044e \u043d\u0430\u00a0\u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430). \u0417\u0430\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043c\u044b \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c <code>CREATE TABLE<\/code> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u00a0\u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<pre><code class=\"sql\">CREATE TABLE events (     id          Int64 NOT NULL,     date        Timestamp,     user_id     Int64,     action_type Utf8,     action      Json,     PRIMARY KEY (                 id     ) );  CREATE TABLE users (     id          Int64 NOT NULL,     access_hash Int64, first_name  Utf8,      PRIMARY KEY (                 id     ) );<\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0442\u0443\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>UPSERT<\/code> (\u044d\u0442\u043e \u043a\u0430\u043a <code>INSERT ... ON CONFLICT DO UPDATE<\/code>). \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0451 \u043e\u0431\u043d\u043e\u0432\u0438\u043c.<\/p>\n<pre><code class=\"sql\">UPSERT INTO events ( id, date, user_id, action_type, action ) VALUES ( $id, $date, $user_id, $action_type, $action );  UPSERT INTO users ( id, access_hash, first_name ) VALUES ( $id, $access_hash, $first_name );<\/code><\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Storager \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 AddEvent \u0438 AddUser:  <\/p>\n<pre><code class=\"go\">type Storager interface { AddEvent(ctx context.Context, event Event) error AddUser(ctx context.Context, user User) error }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u00a0\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8a3\/149\/4f6\/8a31494f65ef1cbd10dc19d8eb0523b4.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438.\" title=\"\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438.\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8a3\/149\/4f6\/8a31494f65ef1cbd10dc19d8eb0523b4.png\"\/><\/p>\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438.<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/106\/1ac\/f8e\/1061acf8e79c060484d8dc139b14ab62.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.\" title=\"\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.\" width=\"834\" height=\"469\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/106\/1ac\/f8e\/1061acf8e79c060484d8dc139b14ab62.png\"\/><\/p>\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/figcaption><\/div>\n<\/figure>\n<h2>4. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/h2>\n<h3>\u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438<\/h3>\n<p>\u041e\u0442\u00a0telethon \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c ID \u0438 AccessHash \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0441\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0445 \u0432\u00a0csv, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u00a0\u0431\u0430\u0437\u0443.<\/p>\n<pre><code class=\"go\">f, err := os.Open(filePath) if err != nil { ... } defer func() { _ = f.Close() }()  csvReader := csv.NewReader(f) people, err := csvReader.ReadAll() if err != nil { ... }  for _, person := range people { var userID, userAccessHash int64 var user User  userID, err = strconv.ParseInt(person[0], 10, 64) if err != nil { ... } userAccessHash, err = strconv.ParseInt(person[1], 10, 64) if err != nil { ... }  \/\/ sleep to prevent FLOOD_WAIT error time.Sleep(5 * time.Second)  user, err = telegram.GetUser(ctx, userID, userAccessHash) if err != nil { ... }  err = ydb.AddUser(ctx, user) if err != nil { ... } } <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 284 \u0441\u0442\u0440\u043e\u043a\u0438.\u00a0   <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/682\/5ce\/80d\/6825ce80df969bb47b553be767a359d8.png\" width=\"1280\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/682\/5ce\/80d\/6825ce80df969bb47b553be767a359d8.png\"\/><\/figure>\n<h3>\u0421\u043e\u0431\u044b\u0442\u0438\u044f<\/h3>\n<p>\u0422\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435\u00a0\u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0437\u00a0API \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 YDB CLI. <\/p>\n<p>\u0424\u0430\u0439\u043b\u044b \u0441\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">ChannelAdminLogEvent( id=1234567890, date=datetime.datetime(2023, 8, 15, 15, 30, 45, tzinfo=datetime.timezone.utc), user_id=1234567890, action=ChannelAdminLogEventActionParticipantJoinByInvite( ... ) )<\/code><\/pre>\n<p>\u0418 \u0447\u0442\u043e\u0431\u044b \u0441\u00a0\u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043a\u00a0\u043a\u0430\u043a\u043e\u0439\u2011\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u00a0\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439. Python \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a \u0447\u0435\u0440\u0435\u0437 eval, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u00a0JSON \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c: <\/p>\n<pre><code class=\"python\">dir_name = \"actions\"  for action in os.listdir(dir_name):     v = \"\".join(open(f\"{dir_name}\/{action}\").readlines())     exec(f\"a = {v}\")      action_type = json.loads(a.action.to_json())[\"_\"]     action_type = action_type[0].lower() + action_type[1:]      action = {         \"id\": a.id,         \"date\": a.date.isoformat(),         \"user_id\": a.user_id,         \"action_type\": action_type,         \"action\": a.action.to_json(),     }     print(json.dumps(action))<\/code><\/pre>\n<p>\u0414\u043b\u044f\u00a0\u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u00a0\u0442\u0430\u0431\u043b\u0438\u0446\u0435 (\u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u00a0\u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u00a0\u0444\u0430\u0439\u043b \u043f\u0440\u044f\u043c\u043e \u0442\u0430\u043a: <\/p>\n<pre><code class=\"bash\">> python3 parse.py > events.json<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3a\/50b\/aad\/e3a50baad975ccea3f6930b75db12db6.png\" alt=\"\u041d\u0435\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430.\" title=\"\u041d\u0435\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430.\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e3a\/50b\/aad\/e3a50baad975ccea3f6930b75db12db6.png\"\/><\/p>\n<div><figcaption>\u041d\u0435\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f yc \u0438 YDB: <\/p>\n<pre><code class=\"bash\"># \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u043b\u0430\u043a\u043e\u043c > yc config profile activate my-cloud  # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 > yc ydb database list --folder-id &lt;folder-id> +------------+-----------+--------- |     ID     |   NAME    |   ...  +------------+-----------+--------- |    ....    | channeler |   ... +------------+-----------+---------  # \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c iam-\u0442\u043e\u043a\u0435\u043d \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u044f\u0434\u043e\u043c > yc iam create-token > my-token  # \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0447\u0435\u0440\u0435\u0437 ydb \u0444\u0430\u0439\u043b events.json \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 events > ydb --iam-token-file my-token \\ > -e grpcs:\/\/ydb.serverless.yandexcloud.net:2135 \\ > -d \/ru-central1\/... \\ > import file json -p myy_events events.json  Elapsed: 0.342391 sec<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 465 \u0441\u0442\u0440\u043e\u043a.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e3\/45d\/d54\/5e345dd5427cf122223a2718e92a1a4c.png\" width=\"1280\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5e3\/45d\/d54\/5e345dd5427cf122223a2718e92a1a4c.png\"\/><\/figure>\n<h2>5. \u0421\u0442\u0440\u043e\u0438\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0438<\/h2>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432<a href=\"https:\/\/datalens.yandex.ru\"> <u>DataLens<\/u><\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u00a0\u043d\u0430\u0448\u0435\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 YDB: <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f8\/a95\/fe3\/5f8a95fe36a38e85d51b286719d0ad2b.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f8\/a95\/fe3\/5f8a95fe36a38e85d51b286719d0ad2b.png\"\/><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0430\u0442\u0430\u0441\u0435\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2bd\/d41\/0a4\/2bdd410a4161cd65fcde0a50db5fd1c8.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2bd\/d41\/0a4\/2bdd410a4161cd65fcde0a50db5fd1c8.png\"\/><\/figure>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b\u0438\u0441\u044c \u043d\u0435\u00a0\u0441\u00a0\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u0430\u043d\u0430\u043b\u0430, \u0442\u043e \u0437\u0430\u0434\u0430\u0451\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u00a0\u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043d\u0430\u00a0\u043d\u0430\u0447\u0430\u043b\u043e \u043f\u043e\u0434\u0441\u0447\u0435\u0442\u0430. <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/23b\/cd6\/436\/23bcd64360516993e45df7ed5a2abc9d.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/23b\/cd6\/436\/23bcd64360516993e45df7ed5a2abc9d.png\"\/><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>subscribers_delta<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f:  <\/p>\n<pre><code class=\"sql\">CASE [action_type]     WHEN \"channelAdminLogEventActionParticipantJoin\" THEN 1     WHEN \"channelAdminLogEventActionParticipantJoinByInvite\" THEN 1     WHEN \"channelAdminLogEventActionParticipantJoinByRequest\" THEN 1     WHEN \"channelAdminLogEventActionParticipantLeave\" THEN -1     ELSE 0 END<\/code><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>subscribers_count<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f:  <\/p>\n<pre><code class=\"sql\">[initial_subscribers_count] + RSUM(SUM([subscribers_delta]), \"asc\" ORDER BY [date])<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0443\u00a0\u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0439 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0447\u0430\u0440\u0442\u00a0\u2014 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432! <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3aa\/bf2\/343\/3aabf23431c488ff8d6e4babcce6b00f.png\" width=\"1280\" height=\"720\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3aa\/bf2\/343\/3aabf23431c488ff8d6e4babcce6b00f.png\"\/><\/figure>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0443\u0442 \u0432\u0438\u0434\u043d\u043e \u0434\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u044f \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0435\u043a\u043b\u0430\u043c\u0438\u0440\u043e\u0432\u0430\u043b \u043a\u0430\u043d\u0430\u043b, \u043f\u0440\u0438\u0441\u0442\u0430\u0432\u0430\u044f \u043a\u00a0\u043b\u044e\u0434\u044f\u043c. \u0418\u043b\u0438\u00a0\u043e\u0442\u043f\u0438\u0441\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u0442\u043e\u0433\u043e\u0432 \u0440\u043e\u0437\u044b\u0433\u0440\u044b\u0448\u0430 \u0440\u043e\u0432\u0435\u0440\u0430. <\/p>\n<p>\u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443, \u0433\u0434\u0435 \u0432\u0438\u0434\u043d\u043e \u0432\u0441\u0435\u0445 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0438\u043b\u0438 \u043d\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0439 = <code>COUNT([event_id])<\/code><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 = <code>MAX([date])<\/code><\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0438\u043b\u0438 \u043d\u0435\u0442 = <code>SUM([subscribers_delta])<\/code><\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/279\/589\/51e\/27958951ea9f4772771470cc6cf6dad1.png\" alt=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438\" title=\"\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438\" width=\"1079\" height=\"607\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/279\/589\/51e\/27958951ea9f4772771470cc6cf6dad1.png\"\/><\/p>\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<h3>6. \u0427\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435<\/h3>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u043e\u00a0\u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u043e\u00a0\u0438\u043d\u0432\u0430\u0439\u0442\u2011\u0441\u0441\u044b\u043b\u043a\u0430\u043c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043a\u00a0\u043a\u0430\u043d\u0430\u043b\u0443 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u0447\u0430\u0442, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u0445 \u043a\u0430\u043a\u043e\u043c\u0443\u2011\u043d\u0438\u0431\u0443\u0434\u044c GPT \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u043f\u043e\u0441\u0442\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c, \u0430\u00a0\u043a\u0430\u043a\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e. <\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/774104\/\"> https:\/\/habr.com\/ru\/articles\/774104\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0412\u0430\u0434\u0438\u043c \u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440\u043e\u0432, \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438 \u0443\u00a0\u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0432\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435. \u041a\u0430\u043a\u00a0\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0435 \u0441\u0435\u0431\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u2011\u0430\u0434\u043c\u0438\u043d\u044b, \u044f \u0445\u043e\u0447\u0443 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430\u00a0\u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u0439: \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0442\u044c \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0447\u0442\u043e\u2011\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u0437\u043d\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c\/\u043e\u0442\u043f\u0438\u0441\u0430\u043b\u0438\u0441\u044c.<\/p>\n<p>\u0412\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435 \u0438\u0437\u00a0\u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a\u0438\u0435\u2011\u0442\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0438. \u041d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a0\u0434\u043d\u044f, \u0447\u0442\u043e\u00a0\u043d\u0435\u00a0\u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 drill down \u0434\u043e\u00a0\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f. <\/p>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043a\u0430\u043a\u00a0\u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 API \u044f \u043c\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u0412\u00a0\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0438 \u043a\u0430\u043a\u00a0\u044f \u0441\u043e\u0431\u0440\u0430\u043b \u0441\u00a0\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432: YDB \u0432\u00a0\u0440\u0435\u0436\u0438\u043c\u0435 serverless \u0438 DataLens. <\/p>\n<h2>1. \u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e as is<\/h2>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0438\u0434\u0438\u043c \u0434\u0430\u0442\u0443 \u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432. \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e \u0432\u0441\u0451.<\/figcaption><\/div>\n<\/figure>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u00a0\u0442\u0430\u043a\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0442\u0435\u00a0\u0436\u0435 \u043e\u0442\u043f\u0438\u0441\u043a\u0438 \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f\u00a0\u2014 \u0438\u0445 \u0432\u00a0\u0442\u0430\u043a\u043e\u043c \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u043c \u0433\u0440\u0430\u0444\u0438\u043a\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u0432\u0438\u0434\u043d\u043e.<\/p>\n<p>\u041d\u043e\u00a0\u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0435\u043d\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 API \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0441\u00a0\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e\u00a0\u0441\u0435\u043a\u0443\u043d\u0434\u044b;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0430\u043c\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0441\u044b\u043b\u043a\u0430, \u043f\u043e\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0448\u0451\u043b \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a).<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0449\u0451 \u0432\u00a0\u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u0435\u043d\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0432\u00a0\u0441\u0432\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u044f \u0437\u0430\u0433\u043e\u0440\u0435\u043b\u0441\u044f \u0438\u0434\u0435\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u00a0Python: \u043e\u043d \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u00a0\u0430\u0434\u043c\u0438\u043d\u2011\u043f\u0440\u0430\u0432\u0430\u043c\u0438, \u043f\u043e\u043b\u0443\u0447\u0430\u043b \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u043b \u0438\u0445 \u0432\u00a0\u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0432\u00a0\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0440\u044f\u0434\u043e\u043c. <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0421\u043e\u0431\u044b\u0442\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0438\u0441\u044c \u0437\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f.<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0430\u0432\u0434\u0430, \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0451 \u0432\u00a0\u043a\u0430\u043a\u043e\u043c\u2011\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 <code>.stringify()<\/code>  \u0432\u00a0telethon, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u043b \u0442\u0430\u043a\u0438\u043c \u00ab\u0447\u0451\u0440\u043d\u044b\u043c \u044f\u0449\u0438\u043a\u043e\u043c\u00bb. <\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/figcaption><\/div>\n<\/figure>\n<p>\u042d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0431\u044b\u043b \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u043c \u0438 \u043f\u0440\u0438\u0432\u0451\u043b \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c. \u041d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0449\u0451 \u043d\u0435 \u0437\u043d\u0430\u043b \u0438 \u043f\u043e\u0448\u0451\u043b \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0438\u0434\u0435\u044e \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>2. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f  <\/h2>\n<p>\u0414\u043b\u044f\u00a0\u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044f \u0432\u044b\u0431\u0440\u0430\u043b Go \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<a href=\"https:\/\/github.com\/gotd\/td\"> <u>gotd<\/u><\/a>, \u043a\u0430\u043a\u00a0\u0441\u0430\u043c\u0443\u044e \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0443\u044e \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u0443\u044e. <\/p>\n<p>\u0412\u0441\u0451 \u0434\u043e\u043b\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u043c\u044b \u0440\u0430\u0437 \u0432\u00a0\u043c\u0438\u043d\u0443\u0442\u0443 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u0437\u00a0\u043d\u0438\u0445, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u00a0\u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"go\">func main() { \/\/ init  go AdminLogUpdater(ctx, time.Minute, channelID) }  func AdminLogUpdater(ctx context.Context, interval time.Duration, channelID int64) { ticker := time.NewTicker(interval) defer ticker.Stop()  for { err := updateAdminLog(ctx, channelID) if err != nil { \/\/ logging }  select { case &lt;-ticker.C: continue case &lt;-ctx.Done(): return } } }  func updateAdminLog(ctx context.Context, channelID int64) error { resp, err := GetChannelAdminLog(ctx, channelID) if err != nil { return err }  storage.AddEvents(resp.Events) storage.AddUsers(resp.Users)  return nil }<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0432\u0441\u043a\u0440\u044b\u043b\u0430\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441\u00a0telethon, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u0435 \u0434\u0435\u043b\u0430\u043b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f \u0438 \u043d\u0435\u00a0\u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u043b. \u0422\u0430\u043a \u0447\u0442\u043e\u00a0\u043a\u043e\u0434\u0430 \u0434\u043b\u044f\u00a0gotd \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435. <\/p>\n<h3>\u041f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c: \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f  <\/h3>\n<p>\u0412\u00a0Telegram \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432.<\/p>\n<ol>\n<li>\n<p>\u0411\u043e\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c @BotFather \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0434\u0430\u0435\u0442 ID \u0438 \u0442\u043e\u043a\u0435\u043d. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u00a0URL, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u043f\u043e\u043b\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a<a href=\"https:\/\/core.telegram.org\/bots\/api\"> <u>Bot API<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u044e\u0437\u0435\u0440\u044b \u0441\u00a0\u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0414\u043b\u044f\u00a0\u043d\u0435\u0433\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u0435\u043d \u043d\u043e\u043c\u0435\u0440 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044c, \u0430\u00a0\u043f\u043e\u0442\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u043a\u0442\u043e\u0440: \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u0434\u00a0\u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 \u0443\u0436\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e,\u00a0\u043b\u0438\u0431\u043e \u0447\u0435\u0440\u0435\u0437 SMS.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0435\u0439 \u043d\u0435\u00a0\u0432\u044b\u0439\u0434\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043d\u0430\u00a0\u0434\u0432\u0443\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0435\u0451 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0442. \u0422\u0430\u043a\u0436\u0435 \u0443\u00a0\u043d\u0435\u0451 \u0435\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438, \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u0430\u043c\u0430 \u0441\u0442\u0430\u0442\u044c \u043d\u0435\u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043b\u043e\u0433\u0438\u043d\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430\u00a0\u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0432\u00a0\u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u0414\u0430\u00a0\u0438 \u043a\u0430\u043a\u0438\u0435\u2011\u0442\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u043b\u0438\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u0431\u043e\u0442\u0430.<\/p>\n<h3>\u0412\u0442\u043e\u0440\u0430\u044f \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u044c: \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 AccessHash<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e\u2011\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u0431\u00a0\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 \u0438\u043b\u0438\u00a0\u0447\u0430\u0442\u0435, \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c AccessHash\u00a0\u2014 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u00a0\u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430\u00a0\u043b\u0438\u043d\u043a\u0435\u0440 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u00a0\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0415\u0433\u043e \u0434\u0430\u044e\u0442, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0451\u043b \u043a\u043e\u043d\u043d\u0435\u043a\u0442: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u00a0\u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u00a0\u043a\u0430\u043d\u0430\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0436\u0430\u0442\u044c \u043d\u0430\u00a0\u0438\u043c\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432\u00a0\u0435\u0433\u043e \u043f\u0440\u043e\u0444\u0438\u043b\u044c. <\/p>\n<p>\u041a\u00a0\u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0410\u00a0\u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043a\u0430\u043d\u0430\u043b X, \u0442\u043e \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0430\u043d AccessHash = 123. \u0410\u00a0\u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0411 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043b\u0441\u044f \u043d\u0430\u00a0\u043a\u0430\u043d\u0430\u043b X, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d AccessHash = 456. \u0418 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0411 \u0437\u0430\u0432\u043b\u0430\u0434\u0435\u0435\u0442 AccessHash, \u044d\u0442\u043e \u043d\u0435\u00a0\u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0435\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u00a0\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 \u0410, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u00a0\u0434\u043b\u044f\u00a0\u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u2011\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0445\u044d\u0448 \u0431\u0443\u0434\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c. <\/p>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f\u00a0\u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438: \u0438\u043d\u0430\u0447\u0435 \u043c\u043e\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u0430\u043d\u0430\u043b\u044b \u0438 \u0447\u0430\u0442\u044b \u0432\u00a0\u0446\u0438\u043a\u043b\u0435, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f\u00a0\u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438 \u0441\u043f\u0430\u043c\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u043a\u0443\u044e\u2011\u0442\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u00a0\u043d\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0438 \u0443\u0437\u043d\u0430\u0442\u044c \u0445\u044d\u0448.<\/p>\n<p>\u0412\u00a0telethon \u044d\u0442\u0438 \u0445\u044d\u0448\u0438\u00a0\u0431\u044b\u043b\u0438 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u044b, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u00a0\u0431\u0430\u0437\u0435 SQLite \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0441\u0430\u043c\u0438. \u0412\u00a0\u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 AccessHash \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e\u043c, \u0447\u0442\u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0443\u0436\u0435 \u00ab\u0437\u043d\u0430\u043a\u043e\u043c\u00bb \u0441\u00a0\u043d\u0430\u043c\u0438 \u0438 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u043b\u00a0\u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u00a0\u043d\u0430\u0448\u0438\u043c \u043a\u0430\u043d\u0430\u043b\u043e\u043c. \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u0442\u00a0\u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u0430\u043d\u0430\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0442\u043e AccessHash \u0434\u043e\u043b\u0436\u0435\u043d\u00a0\u0431\u044b\u0442\u044c \u043f\u043e\u0434\u00a0\u0440\u0443\u043a\u043e\u0439.\u00a0<\/p>\n<h2>3. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439  <\/h2>\n<p>\u0414\u043b\u044f\u00a0\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b Serverless YDB \u0432\u00a0Yandex Cloud\u00a0\u2014 \u0438 \u043d\u0435\u00a0\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u00a0\u0444\u0443\u0442\u0431\u043e\u043b\u043a\u0443 \u043f\u043e\u0434\u0430\u0440\u0438\u043b\u0438.<\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e pet\u2011\u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u00a0\u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u044b\u0431\u0438\u0440\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u043f\u043e\u00a0\u0446\u0435\u043d\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<br \/>\u0412\u00a0serverless\u2011\u0440\u0435\u0436\u0438\u043c\u0435 \u0434\u043b\u044f\u00a0\u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u00a0\u043d\u0443\u0436\u0435\u043d \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0439 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440, \u0430\u00a0\u0442\u0430\u0440\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u00a0\u0443\u0447\u0451\u0442\u043e\u043c\u00a0\u043b\u0438\u043c\u0438\u0442\u043e\u0432, \u0433\u0434\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432\u00a0\u043c\u0435\u0441\u044f\u0446 \u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0443\u0442 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c\u0438, \u044d\u0442\u0438\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u0441\u043e\u0432\u0441\u0435\u043c \u0431\u0435\u0437\u00a0\u0431\u044e\u0434\u0436\u0435\u0442\u0430.<\/p>\n<p>\u041f\u0440\u0438\u00a0\u044d\u0442\u043e\u043c \u0432\u00a0\u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0434\u043b\u044f\u00a0\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u0438 \u0437\u0430\u0449\u0438\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00a0\u2014 \u0432\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043d\u0435\u00a0\u0431\u0443\u0434\u0443 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u00a0\u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u043d\u043e\u00a0\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/cloud.yandex.ru\/docs\/ydb\/security\/\"><u>\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441\u00a0\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e\u00a0\u0442\u0435\u043c\u0435<\/u><\/a>. <\/p>\n<h3>\u0420\u0430\u0437\u043c\u0435\u0447\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/h3>\n<p>\u0414\u043b\u044f\u00a0\u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0443\u043c\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0432\u0430 \u0442\u0438\u043f\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e: ID, AccessHash, \u0438\u043c\u044f (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439). \u041f\u0440\u0438\u00a0\u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0433\u043b\u0430\u0432\u043d\u043e\u0435,\u00a0\u2014 \u043e\u043f\u044f\u0442\u044c\u00a0\u0436\u0435, \u043d\u0435\u00a0\u0437\u0430\u0431\u044b\u0442\u044c \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e <a href=\"https:\/\/cloud.yandex.ru\/security\/data-privacy\"><u>\u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0438\u043c ID, \u0432\u0440\u0435\u043c\u044f, ID \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0438\u043f \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0438 \u0432\u0441\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u00a0\u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e\u00a0golang\u2011migrate \u043d\u0435\u00a0\u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u00a0YDB (\u0435\u0441\u043b\u0438 \u043a\u0442\u043e\u2011\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442 \u043d\u0430\u0443\u0447\u0438\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u0435, \u0438 \u044f \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044e \u043d\u0430\u00a0\u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430). \u0417\u0430\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043c\u044b \u043d\u0435\u00a0\u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c <code>CREATE TABLE<\/code> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u00a0\u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<pre><code class=\"sql\">CREATE TABLE events (     id          Int64 NOT NULL,     date        Timestamp,     user_id     Int64,     action_type Utf8,     action      Json,     PRIMARY KEY (                 id     ) );  CREATE TABLE users (     id          Int64 NOT NULL,     access_hash Int64, first_name  Utf8,      PRIMARY KEY (                 id     ) );<\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e\u00a0\u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0442\u0443\u0442 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>UPSERT<\/code> (\u044d\u0442\u043e \u043a\u0430\u043a <code>INSERT ... ON CONFLICT DO UPDATE<\/code>). \u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u00a0\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0451 \u043e\u0431\u043d\u043e\u0432\u0438\u043c.<\/p>\n<pre><code class=\"sql\">UPSERT INTO events ( id, date, user_id, action_type, action ) VALUES ( $id, $date, $user_id, $action_type, $action );  UPSERT INTO users ( id, access_hash, first_name ) VALUES ( $id, $access_hash, $first_name );<\/code><\/pre>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Storager \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 AddEvent \u0438 AddUser:  <\/p>\n<pre><code class=\"go\">type Storager interface { AddEvent(ctx context.Context, event Event) error AddUser(ctx context.Context, user User) error }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u00a0\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438 \u0432\u0438\u0434\u0438\u043c \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435!<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438.<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/figcaption><\/div>\n<\/figure>\n<h2>4. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f<\/h2>\n<h3>\u041f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0438<\/h3>\n<p>\u041e\u0442\u00a0telethon \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u00a0\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c ID \u0438 AccessHash \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0441\u00a0\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b. \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0445 \u0432\u00a0csv, \u0430\u00a0\u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u00a0\u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u00a0\u0431\u0430\u0437\u0443.<\/p>\n<pre><code class=\"go\">f, err := os.Open(filePath) if err != nil { ... } defer func() { _ = f.Close() }()  csvReader := csv.NewReader(f) people, err := csvReader.ReadAll() if err != nil { ... }  for _, person := range people { var userID, userAccessHash int64 var user User  userID, err = strconv.ParseInt(person[0], 10, 64) if err != nil { ... } userAccessHash, err = strconv.ParseInt(person[1], 10, 64) if err != nil { ... }  \/\/ sleep to prevent FLOOD_WAIT error time.Sleep(5 * time.Second)  user, err = telegram.GetUser(ctx, userID, userAccessHash) if err != nil { ... }  err = ydb.AddUser(ctx, user) if err != nil { ... } } <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c 284 \u0441\u0442\u0440\u043e\u043a\u0438.\u00a0   <\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0421\u043e\u0431\u044b\u0442\u0438\u044f<\/h3>\n<p>\u0422\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435\u00a0\u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0437\u00a0API \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 YDB CLI. <\/p>\n<p>\u0424\u0430\u0439\u043b\u044b \u0441\u00a0\u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">ChannelAdminLogEvent( id=1234567890, date=datetime.datetime(2023, 8, 15, 15, 30, 45, tzinfo=datetime.timezone.utc), user_id=1234567890, action=ChannelAdminLogEventActionParticipantJoinByInvite( ... ) )<\/code><\/pre>\n<p>\u0418 \u0447\u0442\u043e\u0431\u044b \u0441\u00a0\u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u043a\u00a0\u043a\u0430\u043a\u043e\u0439\u2011\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0435\u0437\u00a0\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0439. Python \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a \u0447\u0435\u0440\u0435\u0437 eval, \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u00a0JSON \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c: <\/p>\n<pre><code class=\"python\">dir_name = \"actions\"  for action in os.listdir(dir_name):     v = \"\".join(open(f\"{dir_name}\/{action}\").readlines())     exec(f\"a = {v}\")      action_type = json.loads(a.action.to_json())[\"_\"]     action_type = action_type[0].lower() + action_type[1:]      action = {         \"id\": a.id,         \"date\": a.date.isoformat(),         \"user_id\": a.user_id,         \"action_type\": action_type,         \"action\": a.action.to_json(),     }     print(json.dumps(action))<\/code><\/pre>\n<p>\u0414\u043b\u044f\u00a0\u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0444\u0430\u0439\u043b, \u0433\u0434\u0435 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u00a0\u0442\u0430\u0431\u043b\u0438\u0446\u0435 (\u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0435\u00a0\u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0432\u00a0\u0444\u0430\u0439\u043b \u043f\u0440\u044f\u043c\u043e \u0442\u0430\u043a: <\/p>\n<pre><code class=\"bash\">> python3 parse.py > events.json<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u041d\u0435\u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f yc \u0438 YDB: <\/p>\n<pre><code class=\"bash\"># \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u043e\u0431\u043b\u0430\u043a\u043e\u043c > yc config profile activate my-cloud  # \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 > yc ydb database list --folder-id &lt;folder-id> +------------+-----------+--------- |     ID     |   NAME    |   ...  +------------+-----------+--------- |    ....    | channeler |   ...<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-360255","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=360255"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360255\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}