{"id":339146,"date":"2022-09-30T15:00:11","date_gmt":"2022-09-30T15:00:11","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=339146"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=339146","title":{"rendered":"<span>\u041a\u0430\u043a \u043c\u044b \u0432 SegmentStream \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Cube<\/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<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u00a0\u00a0\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439, \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 SegmentStream, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043c\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Cube \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0441\u0430\u043c Cube, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 Cube, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/cube.dev\/docs\/\" rel=\"noopener noreferrer nofollow\"><u>cube.dev\/docs<\/u><\/a>. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e <a href=\"https:\/\/segmentstream.com\/\" rel=\"noopener noreferrer nofollow\"><u>SegmentStream<\/u><\/a>, \u0442\u043e \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c SaaS-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0417\u0432\u0443\u0447\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/segmentstream.com\/blog\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c<\/u><\/a>, \u0442\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439.<\/p>\n<p>\u00a0\u00a0\u0422\u0430\u043a\u0436\u0435, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 TypeScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0442\u044c\u0441\u044f \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443.<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c Cube<\/h3>\n<p>\u00a0\u00a0\u0418\u0442\u0430\u043a, \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2022 \u0433\u043e\u0434\u0430 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u043e\u0432\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043d\u043e\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0440\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.\u00a0<\/p>\n<p>\u00a0\u00a0\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a-\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0447\u0451\u0442\u044b \u0447\u0435\u0440\u0435\u0437 Google Data Studio, \u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u044b\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 iframe.\u00a0<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/06f\/72f\/b97\/06f72fb978a562e5a2f95d6e7fb4e111.png\" width=\"1600\" height=\"847\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/06f\/72f\/b97\/06f72fb978a562e5a2f95d6e7fb4e111.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u00a0\u00a0\u041d\u043e \u044d\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0431\u0435\u0434\u044b. O\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0442\u0447\u0451\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0438, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e \u0432\u044b\u043b\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u00a0\u00a0\u041e\u0446\u0435\u043d\u0438\u0432 \u0432\u0441\u0435 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0435\u0437\u0436\u0430\u0442\u044c \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451, \u0447\u0442\u043e-\u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0445 \u0434\u0435\u043d\u0435\u0433, \u0438 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438. \u0410 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 BigQuery, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u0432 BigQuery \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u0434\u0430\u043d\u043d\u044b\u0435-\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442) \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 OAuth2.0;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0447\u0451\u0442\u043e\u0432, \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043d\u0430 2 \u0437\u0434\u043e\u0440\u043e\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e 20-30 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0441 10 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0438 30 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u0430\u044f;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u043d\u0435\u0433 \u0432 BigQuery, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 BigQuery;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043e\u0442 \u043d\u0430\u0441.<\/p>\n<\/li>\n<\/ol>\n<p>\u00a0\u00a0\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Cube. \u041d\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u0438 \u0447\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430 TypeScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0412\u043e\u0442 \u0442\u0430\u043a Cube \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0430 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 Cube):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/304\/d0e\/a59\/304d0ea59bbb40c47245b0db78a71ac1.png\" width=\"1600\" height=\"1059\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/304\/d0e\/a59\/304d0ea59bbb40c47245b0db78a71ac1.png\"\/><figcaption><\/figcaption><\/figure>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>API \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>Cube Refresh Worker \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>Redis \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u0435\u0448 \u0438 \u0448\u0438\u043d\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0442\u0435\u0440 Cube Store \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u0438\u043c.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u00a0\u0422\u0443\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438. \u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0439 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<p>\u00a0\u00a0Cube Store \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0444\u0430\u0439\u043b\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 parquet \u0438 \u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0438\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u00a0\u00a0\u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0438 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Cube.<\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u0440\u043e Cube<\/h3>\n<p>\u00a0\u00a0\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Cube, \u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e \u0445\u043e\u0434\u0443 \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u0441\u044c\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u044b, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a Cube.<\/p>\n<p>\u00a0\u00a0\u0412 Cube \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u0443\u0431\u043e\u0432 (\u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e), \u043a\u0443\u0431 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"javascript\">cube(`Users`, {  sql: `SELECT * FROM users`,    measures: {    count: {      sql: `id`,      type: `count`,    },  },    dimensions: {    city: {      sql: `city`,      type: `string`,    },      companyName: {      sql: `company_name`,      type: `string`,    },  }, });<\/code><\/pre>\n<p>\u00a0\u00a0\u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 sql-\u0437\u0430\u043f\u0440\u043e\u0441, 1 measure \u0438 2 dimension. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0442\u043e measure \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0430 dimension &#8212; \u0442\u043e, \u043f\u043e \u0447\u0435\u043c\u0443 \u0445\u043e\u0442\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 Cube \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"javascript\">{   dimensions: ['Users.city'],   measures: ['Users.count'] }<\/code><\/pre>\n<p>\u00a0\u00a0\u041d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0440\u043e\u0433\u043e, \u0434\u0430 \u0438 \u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0446\u0435\u0439 \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Cube \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0443\u0431\u043e\u043c, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>\u00a0\u00a0\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u0431\u0435 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">cube(`Orders`, {  sql: `SELECT * FROM users`,    ...,    preAggregations: {     usersByCity: {      dimensions: [CUBE.city],      measures: [CUBE.count],    },  }, }); <\/code><\/pre>\n<p>\u00a0\u00a0\u0422\u0430\u043a, \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c BigQuery, \u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 BigQuery. \u0423 Cube \u0441\u0443\u0449\u0435\u0442\u0441\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0425\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0431\u0430\u0437\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u0438\u043c\u043e\u043c \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 \u0431\u0430\u0437\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 Cube Store;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c exportBucket, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e BigQuery \u0441\u0430\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0444\u0430\u0439\u043b \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0432 CubeStore \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u00a0\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438, \u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043d\u0430 \u0440\u0435\u043c\u0430\u0440\u043a\u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435.<\/p>\n<p>\u00a0\u00a0\u041a\u0430\u043a Cube \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 refreshKey:<\/p>\n<pre><code class=\"javascript\">refreshKey: {   every: `30 seconds`   sql: `SELECT MAX(created_at) FROM users`, }<\/code><\/pre>\n<p>\u00a0\u00a0Cube \u0440\u0430\u0437 \u0432 30 \u0441\u0435\u043a\u0443\u043d\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438.<\/p>\n<h3>OAuth2.0<\/h3>\n<p>\u00a0\u00a0\u0412 Cube \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0435\u0441\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f BigQuery, \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c\u0438, \u0430 \u0443 \u043d\u0430\u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 OAuth 2.0 \u0441\u0438\u0434\u044f\u0442. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u0420\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435.<\/p>\n<pre><code class=\"typescript\">class SegmentStreamBigQueryDriver extends BigQueryDriver {  config: BigQueryDriverOptions;  constructor(config: BigQueryDriverOptions) {    super(config);      this.config = config;    this.pinoLogger = pinoLogger;      if (config.oauthCredentials) {      const refreshClient = new UserRefreshClient();        refreshClient.fromJSON({        type: 'authorized_user',        client_id: config.oauthCredentials.clientId,        client_secret: config.oauthCredentials.clientSecret,        refresh_token: config.oauthCredentials.refreshToken,        project_id: config.projectId,      });        this.bigquery.authClient.cachedCredential = refreshClient;    }  } }<\/code><\/pre>\n<p>\u00a0\u00a0\u041a\u0441\u0442\u0430\u0442\u0438, exportBucket \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 OAuth 2.0 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0441\u044b\u043b\u043e\u043a GCP \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u044e\u0447 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430, \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0442 \u0434\u0435\u043b\u0430.<\/p>\n<h3>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h3>\n<p>\u00a0\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0442\u0430\u0451\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441 \u0444\u0440\u043e\u043d\u0442\u0430 \u043a\u0440\u0435\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 BQ, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043d\u0435 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0443\u0434\u0430? Cube \u0443\u043c\u0435\u0435\u0442 \u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 JWT, \u043d\u043e \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0448\u0451\u043b \u043e\u0442 \u0434\u043e\u0431\u0440\u043e\u0441\u043e\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0438 \u043a\u0440\u0435\u0434\u044b \u043e\u0442 BigQuery \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c.<\/p>\n<p>\u00a0\u00a0\u041c\u044b \u043d\u0435 \u0441\u0442\u0430\u043b\u0438 \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0441\u0443\u043d\u0443\u043b\u0438 \u0432 JWT \u043a\u0440\u0435\u0434\u044b, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0432 \u0438\u0445. \u041d\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043b\u043e\u0432\u0438\u043b\u0438 431 Request Header Fields Too Large<s> \u0438 \u043f\u043e\u0431\u0435\u0436\u0430\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438<\/s> \u0438 \u043f\u043e\u0448\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043b\u0430\u0433\u0438 \u043a \u043d\u043e\u0434\u0435 \u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b \u044d\u0442\u043e \u0438 \u0441\u0430\u043c\u0438 \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"typescript\">interface EncodedCredentials {  content: string;  iv: string; } interface SecurityContext {  projectId: string;  datasetId: string;  oauthCredentials?: EncodedCredentials;  encodedServiceAccount?: EncodedCredentials; }<\/code><\/pre>\n<p>\u00a0\u00a0\u041a\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043a\u043e\u0434, \u0442\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0435\u0449\u0451 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043b\u0438. \u0414\u0430, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u043d\u044f\u0442\u044c \u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 (BigQuery \u0443\u043c\u0435\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0444\u0430\u0439\u043b \u0432 GCP, \u043d\u043e \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0443\u043c\u0435\u0435\u0442 \u043e\u043d \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u043c).<\/p>\n<p>\u00a0\u00a0\u0418\u0442\u043e\u0433\u043e, \u0432\u0441\u044f \u044d\u0442\u0430 \u043a\u0440\u0430\u0441\u043e\u0442\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ol>\n<li>\n<p>\u0424\u0440\u043e\u043d\u0442 \u0438\u0434\u0451\u0442 \u0432 API \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 JWT \u0434\u043b\u044f Cube, \u0432 JWT \u0437\u0430\u0448\u0438\u0442\u044b \u043a\u0440\u0435\u0434\u044b \u043e\u0442 BigQuery, \u0443 JWT, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0441\u0440\u043e\u043a \u0436\u0438\u0437\u043d\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c JWT \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0444\u0440\u043e\u043d\u0442 \u0438\u0434\u0451\u0442 \u0432 Cube;<\/p>\n<\/li>\n<li>\n<p>Cube \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c JWT, \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u0440\u0435\u0434\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SecurityContext;<\/p>\n<\/li>\n<li>\n<p>Cube \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/91c\/adb\/90b\/91cadb90b8825f4c1db2ba13ee7bab9b.png\" width=\"581\" height=\"471\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/91c\/adb\/90b\/91cadb90b8825f4c1db2ba13ee7bab9b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u00a0\u00a0\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Cube Refresh Worker (\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0438\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b) \u043c\u044b \u0438\u0437 API \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0431\u0435\u0437 \u0441\u0442\u0430\u0434\u0438\u0438 \u0437\u0430\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0432 JWT.<\/p>\n<h3>\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u043f\u043e\u043b\u044f updated_at<\/h3>\n<p>\u00a0\u00a0<a href=\"https:\/\/cube.dev\/docs\/caching\/pre-aggregations\/getting-started\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438<\/u><\/a> \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u0430\u044f \u0432\u0435\u0449\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Cube Store: \u0448\u0442\u0443\u043a\u0435\u043d\u0446\u0438\u044f \u043d\u0430 Rust, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0443\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0445\u043e\u0434 BigQuery. Cube \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0441 \u0440\u0430\u0437\u043d\u043e\u0439 \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438, \u043d\u043e \u043a\u043b\u044e\u0447\u0438\u043a\u0430-\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442.<\/p>\n<p>\u00a0\u00a0\u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043d\u0430\u043c \u043e\u0434\u0438\u043d \u0445\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">granularity: `day`, partitionGranularity: `week`, buildRangeStart: { sql: `SELECT DATE_SUB(CURRENT_DATETIME(), INTERVAL 92 DAY)` }, buildRangeEnd: { sql: `SELECT CURRENT_DATETIME()` }, refreshKey: {  every: `5 minutes`,  sql: `SELECT COALESCE(max(last_modified_time), '2020-01-01T00:00:00.000Z') as last_updated_at        FROM \\`INFORMATION_SCHEMA.PARTITIONS\\`        where table_name = 'conversions'          AND partition_id != '__NULL__'          AND ${FILTER_PARAMS.Attribution.date.filter(            \"TIMESTAMP(PARSE_DATE('%Y%m%d', partition_id))\",          )}`, }<\/code><\/pre>\n<p>\u00a0\u00a0\u0412 BigQuery \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 (\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u044b \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u043c).<\/p>\n<p>\u00a0\u00a0\u0410 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c \u043a \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0441 \u0436\u0430\u043b\u043e\u0431\u0430\u043c\u0438 \u043d\u0430 \u0441\u043f\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b\u2026 \u0418 \u044d\u0442\u043e, \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0431\u044b\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e: \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442 Cube \u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u043d\u0430\u0442\u0435\u043a\u0430\u043b\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0442\u0430\u043a. \u0410 \u0435\u0449\u0451 BigQuery \u0442\u0440\u0430\u0442\u0438\u0442 10 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 (\u043f\u043e\u0447\u0435\u043c\u0443 &#8212; \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441), \u0438 \u0437\u0430 \u043c\u0435\u0441\u044f\u0446 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043a\u0430\u043f\u0430\u0442\u044c \u043f\u043e\u0434 \u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442.<\/p>\n<p>\u00a0\u00a0\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043c\u044b \u0438 \u0442\u0430\u043a \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0431\u044b\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 (\u043c\u044b \u0436\u0435 \u0435\u0451 \u0441\u0430\u043c\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c), \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043f\u043e\u0445\u043e\u0434\u044b Cube \u043d\u0430 BigQuery. Cube \u0432 \u0431\u0435\u043a\u0435\u043d\u0434 \u0441 \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0443\u043c\u0435\u0435\u0442, \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0432 Cube \u0438 \u043f\u043e\u0434\u0442\u044e\u043d\u0438\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0443\u043c\u0435\u043b \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0432 redis, \u0430 \u043a\u0435\u0448 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0443\u0436\u0435 \u0441\u0430\u043c\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c. \u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u043a\u043e\u0434 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438. \u041c\u044b \u0437\u0430\u043e\u0434\u043d\u043e \u0437\u0430\u043c\u043e\u043a\u0430\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 buildRangeStart \u0438 buildRangeEnd, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 BigQuery \u043b\u0435\u0437\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.<\/p>\n<pre><code class=\"typescript\"> async runQueryJob&lt;T = QueryRowsResponse>(    initBigQueryQuery: Query,    options: any,    withResults = true,  ): Promise&lt;T> {    \/\/ Parenthesized expression cannot be parsed as an expression, struct constructor, or subquery    const bigQueryQuery = {      ...initBigQueryQuery,      query: this.replaceILIKE(initBigQueryQuery.query || ''), \/\/ BigQuery doesn't support ILIKE    };      if (bigQueryQuery.query === 'SELECT CURRENT_DATETIME()') {      return [        [          {            f0_: {              value: new Date().toISOString(),            },          },        ],      ] as unknown as T;    }      if (bigQueryQuery.query === 'SELECT DATE_SUB(CURRENT_DATETIME(), INTERVAL 92 DAY)') {      return [        [          {            f0_: {              value: new Date(Date.now() - 1000 * 60 * 60 * 24 * 92).toISOString(),            },          },        ],      ] as unknown as T;    }      if (this.cacheRenewewer &amp;&amp; bigQueryQuery.query?.includes(`INFORMATION_SCHEMA.PARTITIONS`)) {      const tableName = bigQueryQuery.query.match(\/table_name = '([a-zA-Z0-9]*)'\/);      const { projectId, datasetId } = this.config;      if (tableName &amp;&amp; tableName[1] &amp;&amp; projectId &amp;&amp; datasetId) {        const postfix = `${bigQueryQuery.params?.join('_').replace(\/[-:\\.]\/, '_') || ''}_${          tableName[1]        }`;        const cachedResult = await this.cacheRenewewer.getRecord(projectId, datasetId, postfix);          if (cachedResult) {          return cachedResult;        }          this.pinoLogger.info(          {            projectId,            datasetId,            postfix,            tableName: tableName[1],            params: bigQueryQuery.params,          },          'Request pre-aggregation last_updatet_at from DB',        );          const [preAggregationJob] = await this.bigquery          .dataset(this.config.datasetId)          .createQueryJob(bigQueryQuery);        const result = (await this.waitForJobResult(          preAggregationJob,          options,          withResults,        )) as any as T;        await this.cacheRenewewer.setRecord(projectId, datasetId, postfix, result);        return result;      }    }      const [job] = await this.bigquery.dataset(this.config.datasetId).createQueryJob(bigQueryQuery);    return (await this.waitForJobResult(job, options, withResults)) as any as T;  }<\/code><\/pre>\n<p>\u00a0\u00a0\u041a\u043e\u0434 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442: \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u044b \u043e\u0442\u0434\u0430\u0451\u043c \u0441\u0430\u043c\u0438 (\u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u0447\u0442\u043e \u0432 Cube \u043d\u0435\u043b\u044c\u0437\u044f \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0437 \u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439), \u0432\u0441\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u043c\u044b \u043a\u0438\u0434\u0430\u0435\u043c \u0432 \u043a\u0435\u0448 \u0438 \u043e\u0442\u0434\u0430\u0451\u043c \u0438\u0437 \u043d\u0435\u0433\u043e, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043d\u0430\u0448\u0435\u0433\u043e \u0431\u0435\u043a\u0435\u043d\u0434\u0430 \u043e\u0431\u043d\u043e\u0432\u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u043e \u043c\u044b \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u0435\u0448. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0435\u0448\u0435\u043d\u0430, \u0443\u0440\u0430!<\/p>\n<h3>\u0423\u0442\u0435\u043a\u0430\u044e\u0449\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c<\/h3>\n<p>\u00a0\u00a0\u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u0438\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/79f\/eed\/5f7\/79feed5f7ca1cf322d7520ac931cdbf9.png\" width=\"1600\" height=\"398\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/79f\/eed\/5f7\/79feed5f7ca1cf322d7520ac931cdbf9.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/620\/c82\/a2b\/620c82a2bc90105c78b4ccd1052b5a88.png\" width=\"1600\" height=\"395\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/620\/c82\/a2b\/620c82a2bc90105c78b4ccd1052b5a88.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u00a0\u00a0\u00a0 <\/p>\n<p>\u00a0\u00a0\u041c\u044b \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u0442\u0430\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f Cube \u043a \u043a\u0440\u0443\u043f\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u0441\u0430\u043c\u0438 \u0441\u0435\u0431\u0435 \u0437\u043b\u044b\u0435 \u0411\u0443\u0440\u0430\u0442\u0438\u043d\u043e \u0438 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0441 exportBucket, \u043d\u043e \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0443 \u043d\u0430\u0441 \u0431\u044b\u043b \u0442\u043e\u043b\u044c\u043a\u043e OAuth2.0. \u0414\u0430 \u0438, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u0441\u0442\u0440\u0438\u043c\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0435\u0441\u0442\u044c 15 \u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442. \u041f\u043e\u0448\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c <s>console.log<\/s> \u0434\u0435\u0431\u0430\u0433 \u0438 \u043d\u0430\u0448\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0432 Cube, \u0430 \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 BigQuery. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433 \u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 BigQuery \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0441\u0442\u0440\u0438\u043c\u0438\u043d\u0433 \u0438 \u0435\u0441\u0442 \u043f\u0430\u043c\u044f\u0442\u044c. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043e\u0431\u0451\u0440\u0442\u043a\u0443. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0441\u0442\u0440\u0438\u043c\u044b \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u044e.<\/p>\n<pre><code class=\"typescript\">import { Readable } from 'stream'; import { BigQuery, Dataset, Job, QueryResultsOptions } from '@google-cloud\/bigquery';   class BigQueryReadStream extends Readable {  nextQuery: QueryResultsOptions | null;  rowsBuffer: any[] = [];  constructor(protected job: Job, protected limitPerPage: number) {    super({      objectMode: true,    });      this.nextQuery = {      autoPaginate: false,      maxResults: limitPerPage,    };  }    protected manualPaginationCallback(    err: Error | null,    rows: any[] | null | undefined,    nextQuery: QueryResultsOptions | null | undefined,  ) {    if (err) {      return this.destroy(err);    }      this.nextQuery = nextQuery || null;    this.rowsBuffer.push(...(rows || []));    this.push(this.rowsBuffer.shift() || null);  }    protected readFromBQ() {    if (!this.nextQuery) {      return this.push(null);    }    this.job.getQueryResults(this.nextQuery, this.manualPaginationCallback.bind(this));  }    async _read() {    if (this.rowsBuffer.length === 0) {      this.readFromBQ();    } else {      this.push(this.rowsBuffer.shift());    }  } }   interface BigQueryParams {  bigquery: BigQuery;  dataset?: string; }   export const createQueryStream = async (  bigquery: BigQueryParams,  query: string,  params: unknown[],  limitPerPage = 1000, ): Promise&lt;Readable> => {  const instance: BigQuery | Dataset = bigquery.dataset    ? bigquery.bigquery.dataset(bigquery.dataset)    : bigquery.bigquery;    \/\/ Run the query as a job  const [job] = await instance.createQueryJob({    query,    params,    parameterMode: 'positional',    useLegacySql: false,  });    \/\/ For all options, see https:\/\/cloud.google.com\/bigquery\/docs\/reference\/v2\/jobs\/getQueryResults  const queryResultsOptions = {    \/\/ Retrieve zero resulting rows.    maxResults: 0,  };    \/\/ Wait for the job to finish.  await job.getQueryResults(queryResultsOptions);    return new BigQueryReadStream(job, limitPerPage); };<\/code><\/pre>\n<p>\u00a0\u00a0\u041d\u0443 \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432 \u0441\u0430\u043c Cube \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"typescript\"> public async stream(query: string, values: unknown[]): Promise&lt;any> {    const streamUUID = randomUUID();    this.pinoLogger.info(      {        streamUUID,        query,        projectId: this.config.projectId,        datasetId: this.config.datasetId,      },      `Starting stream ${streamUUID}: ${query}`,    );      const stream = await createQueryStream(      {        bigquery: this.bigquery,        dataset: this.config.datasetId,      },      query,      values,      this.config.limitPerPage || 1000,    );    const rowStream = new HydrationStream({ streamUUID }, (message: string, params: any) =>      this.pinoLogger.info(params, message),    );    stream.pipe(rowStream);    return {      rowStream,    };  } }<\/code><\/pre>\n<h3>Custom dimensions<\/h3>\n<p>\u00a0\u00a0\u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0431\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u0431\u043e\u0440 dimensions \u0438\u00a0 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439, \u043d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0443\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u043c\u0443 \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c dimensions? \u0421\u0445\u0435\u043c\u0430-\u0442\u043e \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0431\u0449\u0430\u044f, \u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u043d\u044b\u0435. \u041c\u044b \u043d\u0430\u0437\u0432\u0430\u043b\u0438 \u044d\u0442\u043e <a href=\"https:\/\/segmentstream.com\/blog\/product-updates\/2022\/06\/01\/monthly-updates-may-2022\" rel=\"noopener noreferrer nofollow\"><u>custom dimensions<\/u><\/a>.<\/p>\n<p>\u00a0\u00a0\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 Cube \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043d\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u043b\u044c\u043d\u0438\u043a\u043e\u043c. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u201c<a href=\"https:\/\/cube.dev\/docs\/schema\/advanced\/dynamic-schema-creation\" rel=\"noopener noreferrer nofollow\"><u>Dynamic Schema Creation<\/u><\/a>\u201d \u0438 \u043e\u043d\u043e \u043d\u0430\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441.<\/p>\n<p>\u00a0\u00a0\u041d\u044e\u0430\u043d\u0441 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e security context \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441\u0445\u0435\u043c\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c security context \u0438 <a href=\"https:\/\/cube.dev\/docs\/schema\/advanced\/dynamic-schema-creation#usage-with-schema-version\" rel=\"noopener noreferrer nofollow\"><u>\u0432\u0435\u0440\u0441\u0438\u044e \u0441\u0445\u0435\u043c\u044b<\/u><\/a>:<\/p>\n<pre><code class=\"typescript\">function schemaVersion(context: Context) {  const securityContext = extractSecurityContextFromContext(context);  const customDimensions = (securityContext.customDimensions || [])    .map(      customDimension =>        `${customDimension.key}:${customDimension.sql}:${customDimension.type || ''}`,    )    .join(':');  const customDimensionsHash = crypto.createHash('sha256');  customDimensionsHash.update(customDimensions);  return `${getAppIdFromBQConfig(    securityContext.projectId,    securityContext.datasetId,  )}__${customDimensionsHash.digest('hex')}`; }<\/code><\/pre>\n<p>\u00a0\u00a0\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 dimensions \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0445\u0435\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 dimensions \u0437\u0430\u043f\u0438\u0445\u043d\u0443\u0442\u044c \u0432 \u0441\u0445\u0435\u043c\u0443.<\/p>\n<p>\u00a0\u00a0\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0437\u0432\u043b\u0435\u0447\u0451\u043c \u0438\u0445:<\/p>\n<pre><code class=\"javascript\"> const { securityContext } = COMPILE_CONTEXT;  const customDimensions = securityContext.customDimensions || [];<\/code><\/pre>\n<p>\u00a0\u00a0\u0410 \u043f\u043e\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0441\u0445\u0435\u043c\u0443:<\/p>\n<pre><code class=\"javascript\">  dimensions: {         ...customDimensions.reduce((customDimensionsObject, customDimension) => {        if (!customDimension.sql) {          return customDimensionsObject;        }          customDimensionsObject[customDimension.key] = {          sql: customDimension.sql.replace(\/Report\\.([a-zA-Z]+)\/g, (_, dimension) => {            return Report[dimension];          }),          type: customDimension.type || 'string',        };          return customDimensionsObject;      }, {})   }<\/code><\/pre>\n<p>\u00a0\u00a0\u0413\u043e\u0442\u043e\u0432\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c custom dimensions \u043f\u0440\u0438 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<h3>\u0417\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438<\/h3>\n<p>\u00a0\u00a0\u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 (\u0432\u043d\u0435 buildRangeStart \u0438 buildRangeEnd) \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442, \u043f\u0443\u0441\u0442\u043e\u0442\u0430, \u043e\u0434\u043d\u0438 \u043d\u0443\u043b\u0438. \u041f\u043e\u0447\u0435\u043c\u0443? \u0410 \u0432\u043e\u0442 \u0442\u0430\u043a, Cube \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u0438\u0434\u0451\u0442 \u0442\u0443\u0434\u0430, \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u044f \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u043d\u0435 \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u00a0\u00a0\u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u0410 \u043d\u0438\u0447\u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438, \u0442\u043e \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043a\u0430\u043a-\u0442\u043e \u0431\u0435\u0437 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0436\u0438\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0435\u0439\u043a\u043e\u0432\u044b\u0439 measure:<\/p>\n<pre><code class=\"javascript\">notPreaggregatedMeasure: {   sql: `0`,   type: `number`, }<\/code><\/pre>\n<p>\u00a0\u00a0\u041d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u044d\u0442\u0443 \u043c\u0435\u0442\u0440\u0438\u043a\u0443, \u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u043b\u0435\u0442\u0438\u0442 \u0432 \u0411\u0414, \u043d\u0443 \u0438\u043b\u0438 \u0432 \u043a\u044d\u0448.<\/p>\n<h3>\u0421ontinue wait<\/h3>\n<p>\u00a0\u00a0\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432\u0438\u0434\u0430 \u201c\u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0439\u0442\u0435 \u0436\u0434\u0430\u0442\u044c, \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442, \u043d\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435\u201d. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e Cube \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043c \u0441\u0442\u0440\u043e\u0438\u0442 \u043d\u0430 \u0441\u0432\u043e\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435.<\/p>\n<p>\u00a0\u00a0\u041d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u0442\u044f\u043d\u0443\u0442\u044c\u0441\u044f, \u0430 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0435\u0441\u043b\u0438 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u043e\u044f\u0442\u0441\u044f (\u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 Cube \u0434\u0430\u0442\u044c \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c \u0432 \u0440\u0430\u0437\u0440\u0435\u0437\u0435 security context) \u043c\u044b \u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e (\u0447\u0435\u0440\u0435\u0437 notPreaggregatetMeasure) \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u0438\u0432\u0443\u044e \u043a\u0440\u0443\u0442\u0438\u043b\u043a\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u044b \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043c \u0441\u0442\u0440\u043e\u0438\u043c.<\/p>\n<p>\u00a0\u00a0\u0412 \u043e\u0431\u0449\u0435\u043c, \u044d\u0442\u043e\u0442 \u043e\u0442\u0432\u0435\u0442 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439.<\/p>\n<p>\u00a0\u00a0\u041a\u0441\u0442\u0430\u0442\u0438 (\u0432\u043e\u043e\u0431\u0449\u0435, \u043d\u0435\u043a\u0441\u0442\u0430\u0442\u0438), \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c. \u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445? \u041d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043d\u0438\u043a\u0430\u043a. \u041d\u043e \u043c\u043e\u0436\u043d\u043e \u0447\u0443\u0442\u044c \u043f\u043e\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">lastRefreshTime: new Date(   Math.max(     ...row       .serialize()       .loadResponse.results.map(result => new Date(result.lastRefreshTime).valueOf()),   ) )<\/code><\/pre>\n<h3>\u0428\u0430\u0440\u0434\u0438\u043d\u0433 Cube Worker<\/h3>\n<p>\u00a0\u00a0\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b, \u0447\u0442\u043e SegmentStream \u044d\u0442\u043e SaaS. \u0417\u043d\u0430\u0447\u0438\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e SecurityContext, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e, \u043b\u0438\u0431\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435. \u041d\u043e Cube Worker \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c SecurityContext, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0449\u0443\u0442\u0438\u043c\u044b\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 (export bucket \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0443 \u0432\u0441\u0435\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432). \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u0428\u0430\u0440\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u041a\u0430\u043a? \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u043d\u0442\u043d\u043e\u0435 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<p>\u00a0\u00a0\u0414\u043b\u044f \u043a\u043e\u043d\u0441\u0438\u0441\u0442\u0435\u0442\u043d\u043e\u0433\u043e \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u0437\u043d\u0430\u043b \u0441\u0432\u043e\u0439 \u043d\u043e\u043c\u0435\u0440 \u0438 \u0437\u043d\u0430\u043b \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 StatefulSet \u0432 K8S. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0432\u043e\u0440\u043a\u0435\u0440 \u0435\u0433\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u043e\u0432\u044b\u0439 \u043d\u043e\u043c\u0435\u0440, \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u043c\u0435\u043d\u0438 \u0438 \u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u0440\u0435\u043f\u043b\u0438\u043a:<\/p>\n<pre><code class=\"yaml\">         env {            name = \"TOTAL_REPLICAS\"            value = local.replicas          }            env {            name = \"POD_GENERATED_NAME\"            value = \"cubestore-workers-\"          }            env {            name = \"POD_NAME\"            value_from {              field_ref {                field_path = \"metadata.name\"              }            }          } <\/code><\/pre>\n<p>\u00a0\u00a0\u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u043a\u0435\u043a\u0438 <a href=\"https:\/\/github.com\/3rd-Eden\/node-hashring\" rel=\"noopener noreferrer nofollow\"><u>hashring<\/u><\/a> \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043e\u0432:<\/p>\n<pre><code class=\"typescript\">export const podName = process.env.POD_NAME || 'cube-refresh-worker-0'; export const podGeneratedName = process.env.POD_POD_GENERATED_NAME_NAME || 'cube-refresh-worker-'; export const totalRepicas = Number(process.env.TOTAL_REPLICAS || 1);   const hashring = new HashRing(  new Array(totalRepicas).fill(0).map((_, i) => `${podGeneratedName}${i}`), );   const filterSecurityContext = (context: Context) => {  const workerForContext = hashring.get(contextToAppId(context));  return workerForContext === podName; };   const apiClient = new ApiClient(process.env.API_URL || '');   const cube = {  dbType: 'bigquery',  externalDbType: 'cubestore',  cacheAndQueueDriver: 'redis',  scheduledRefreshContexts: async () => {    const scheduledRefreshContexts = !dev      ? (await apiClient.getAllSecurityContexts()).map((bq: SecurityContext) => ({          securityContext: bq,        }))      : undefined;      if (!scheduledRefreshContexts) {      pinoLogger.info(`Unable to fetch contexts`);      return [];    }      pinoLogger.info(`Fetched ${scheduledRefreshContexts.length} contexts`);      const finalContexts = scheduledRefreshContexts.filter(filterSecurityContext);      return finalContexts;  }, }; <\/code><\/pre>\n<p>\u00a0\u00a0\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0441\u043a\u0435\u0439\u043b\u0438\u0442\u044c Cube Worker \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0441\u0441\u0447\u0451\u0442 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439.<\/p>\n<h3>SQL API<\/h3>\n<p>\u00a0\u00a0\u0410 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0441\u0430\u043c\u043e\u043c \u0432\u043a\u0443\u0441\u043d\u043e\u043c &#8212; <a href=\"https:\/\/cube.dev\/docs\/backend\/sql\" rel=\"noopener noreferrer nofollow\"><u>SQL API<\/u><\/a> \u0432 Cube. Cube \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435: \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0441\u0442\u0440\u043e\u0438\u043b\u0438\u0441\u044c, \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0440\u0438\u0441\u043e\u0432\u0430\u043b\u0438\u0441\u044c. \u041d\u043e \u0447\u0442\u043e \u043d\u0430\u043c \u043e\u043f\u044f\u0442\u044c \u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c? \u0412\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u0438 \u0435\u0449\u0451 \u0431\u043e\u043b\u044c\u0448\u0435 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 SQL \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u044f\u043d\u0435\u0442 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e,\u00a0 \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0430 \u0437\u0434\u0435\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u0440\u043e \u043e\u0441\u043d\u043e\u0432\u044b.<\/p>\n<p>\u00a0\u00a0\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e, 50\u043a \u0441\u0442\u0440\u043e\u043a \u0438 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0433\u043e\u043d\u044f\u0442\u044c \u043d\u0430 \u0444\u0440\u043e\u043d\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u0443\u0436\u0435 \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u0430\u0433\u0438\u043d\u0430\u0446\u0438\u0435\u0439.<\/p>\n<p>\u00a0\u00a0\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0441 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u043a\u0430\u043a\u0438\u043c\u0438-\u0442\u043e \u0434\u0432\u0443\u043c\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u0438\u043b\u0438 \u0434\u0438\u0444\u0444 \u043f\u043e \u0434\u0430\u0442\u0430\u043c, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0435\u043a\u0435\u043d\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0432\u0441\u0451 \u044d\u0442\u043e \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0449\u0451 \u043f\u043e \u043b\u044e\u0431\u043e\u043c\u0443 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u043b\u044e.<\/p>\n<p>\u00a0\u00a0\u0427\u0435\u0440\u0435\u0437 REST API \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043d\u0435\u043b\u044c\u0437\u044f. \u0422\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438, \u0447\u0442\u043e, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e, \u044d\u0442\u043e\u0442 API \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0432\u0435\u0449\u0435\u0439 \u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d.<\/p>\n<p>\u00a0\u00a0\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, SQL API \u044d\u0442\u043e API, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e \u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u043c PostgreSQL \u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043b\u044e\u0431\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u043c\u044b \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"typescript\">const firstQuery = `SELECT      ${[     `${         hasDimension ? dimension : \"'none'\"     } as \"${firstIntervalPrefix}dimension\"`,     ...selectMeasures,     ...selectAdditionalMetrics, ].join(',\\n')}      FROM Report WHERE Report.date > '{{ DATE_FROM }}' AND  Report.date &lt; '{{ DATE_TO }}' ${     filter ? `AND ${converFilterIntoSQL(filter)}` : '' }      ${hasDimension ? `GROUP BY \"${firstIntervalPrefix}dimension\"` : ''}    `;  if (!secondDateRange) {     return firstQuery         .replace(\/\\{\\{ DATE_FROM \\}\\}\/, firstDateRange.from)         .replace(\/\\{\\{ DATE_TO \\}\\}\/, firstDateRange.to); }<\/code><\/pre>\n<p>\u00a0\u00a0\u0421\u0430\u043c\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"typescript\">const reportAttributionFieldsMap = new Map([  [ReportAttributionMetric.cost, 'MEASURE(Report.cost)'],  [ReportAttributionMetric.clicks, 'MEASURE(Report.clicks)'],  [ReportAttributionMetric.impressions, 'MEASURE(Report.impressions)'],  [ReportAttributionMetric.users, 'MEASURE(Report.visitors)'],  [ReportAttributionMetric.sessions, 'MEASURE(Report.visits)'],  [ReportAttributionMetric.timeOnSite, 'MEASURE(Report.timeOnSite)'], ]);<\/code><\/pre>\n<p>\u00a0\u00a0\u0427\u0442\u043e \u043d\u0430 \u0441\u0447\u0451\u0442 additionalMetrics, \u0442\u0430\u043a \u044d\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0431\u043e\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430\u0434 \u044d\u0442\u0438\u043c\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438, \u0433\u0434\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438.<\/p>\n<p>\u00a0\u00a0\u041d\u0435 \u0431\u044b\u043b\u043e \u0431\u044b \u043b\u0438\u043c\u0438\u0442\u0430 \u0432 50\u043a \u0441\u0442\u0440\u043e\u043a &#8212; \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u043e\u0432\u0441\u0435\u043c \u0445\u043e\u0440\u043e\u0448\u043e.<\/p>\n<p>\u00a0\u00a0\u0410 \u0432\u043e\u0442 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0443 \u043d\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u0443 Cube \u043d\u0435\u0442 \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f\u043c, \u0430 \u0438\u0437 SQL API \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0442\u0430\u0449\u0438\u0448\u044c (\u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0442). \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0439 REST API \u0438 \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438:<\/p>\n<pre><code class=\"typescript\">const restResult = await cubeJSClient     .query(         queries.dashboard.pingQuery.query([now, oneWeekAgo], conversionsIds),     )     .catch(() => undefined);  const sqlResult = await this.cubejsSQLAPI.requestTable(     projectId,     conversionsIds,     {         ...params,         disablePreaggregation:             params.disablePreaggregation ||             restResult.buildingPreAggregations ||             false,     }, );  return {     lastRefreshTime: restResult?.lastRefreshTime || new Date(),     dimension: params.dimension,     buildingPreAggregations: restResult?.buildingPreAggregations || false,     rows: sqlResult.rows,     totalRows: sqlResult.totalRows, }; <\/code><\/pre>\n<p>\u00a0\u00a0\u0414\u0430, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e, \u043d\u043e \u043f\u043e\u043a\u0430 \u043c\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438.<\/p>\n<p>\u00a0\u00a0\u041d\u0438\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0445\u0435\u043c\u0443, \u043a\u0430\u043a \u0432 \u0438\u0442\u043e\u0433\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/445\/8dc\/e5a\/4458dce5a47870bf76ee32fe0c052c8f.png\" width=\"830\" height=\"744\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/445\/8dc\/e5a\/4458dce5a47870bf76ee32fe0c052c8f.png\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u00a0\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h3>\n<p>\u00a0\u00a0\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e. \u0423\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u043c\u043d\u043e\u0433\u043e\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430 \u043a\u0430\u0434\u0440\u043e\u043c, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0441 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435\u043c \u043d\u0430 \u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0447\u0443.<\/p>\n<p>\u00a0\u00a0\u041f\u043e\u0434\u0432\u043e\u0434\u044f \u0438\u0442\u043e\u0433 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e Cube \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043e\u0442\u0447\u0451\u0442\u043e\u0432 \u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0414\u0430, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u201c\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u201d \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u0430\u043a \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b, \u0438, \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u044d\u0442\u043e \u0432\u0441\u0451 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c\u043e, \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Cube \u0441\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432. \u0418 \u043a\u0441\u0442\u0430\u0442\u0438, \u0432\u0441\u0451 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0441 \u0443\u0441\u043f\u0435\u0445\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0432 k8s, \u0442\u0430\u043a \u0438 \u0432 Cube Cloud.<\/p>\n<p>\u00a0\u00a0\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 Cube \u0437\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b, \u0441\u0432\u043e\u0435\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0444\u0438\u043a\u0441\u044b \u0431\u0430\u0433\u043e\u0432 \u0438 \u0440\u0435\u0432\u044c\u044e \u044d\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u00a0\u00a0\u0410 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0444\u0440\u043e\u043d\u0442 \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043f\u043e\u0434 \u0431\u0435\u043a\u0435\u043d\u0434 Cube SQL API:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/523\/cb1\/e4e\/523cb1e4e1800316783b4788216f39c8.png\" width=\"1600\" height=\"847\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/523\/cb1\/e4e\/523cb1e4e1800316783b4788216f39c8.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/760\/487\/de2\/760487de29f01a711de93c2f176e3f31.png\" width=\"1600\" height=\"847\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/760\/487\/de2\/760487de29f01a711de93c2f176e3f31.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/760\/487\/de2\/760487de29f01a711de93c2f176e3f31.png\" width=\"auto\" height=\"auto\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/760\/487\/de2\/760487de29f01a711de93c2f176e3f31.png\"\/><figcaption><\/figcaption><\/figure>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/post\/690996\/\"> https:\/\/habr.com\/ru\/post\/690996\/<\/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<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u00a0\u00a0\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442. \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043d\u0434\u0440\u0435\u0439, \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 SegmentStream, \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u0434\u0430. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u043c\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 Cube \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e \u0441\u0430\u043c Cube, \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 Cube, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/cube.dev\/docs\/\" rel=\"noopener noreferrer nofollow\"><u>cube.dev\/docs<\/u><\/a>. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e <a href=\"https:\/\/segmentstream.com\/\" rel=\"noopener noreferrer nofollow\"><u>SegmentStream<\/u><\/a>, \u0442\u043e \u043c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c SaaS-\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0445 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f. \u0417\u0432\u0443\u0447\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e, \u043d\u043e \u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e <a href=\"https:\/\/segmentstream.com\/blog\/\" rel=\"noopener noreferrer nofollow\"><u>\u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c<\/u><\/a>, \u0442\u0430\u043c \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439.<\/p>\n<p>\u00a0\u00a0\u0422\u0430\u043a\u0436\u0435, \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 TypeScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0442\u044c\u0441\u044f \u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u042f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443.<\/p>\n<h3>\u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c Cube<\/h3>\n<p>\u00a0\u00a0\u0418\u0442\u0430\u043a, \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 2022 \u0433\u043e\u0434\u0430 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0435\u043b\u0438\u0437\u0430 \u043d\u043e\u0432\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043d\u043e\u0432\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0441\u043a\u0440\u044b\u0442\u044c \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.\u00a0<\/p>\n<p>\u00a0\u00a0\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043a-\u0442\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u043b\u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0447\u0451\u0442\u044b \u0447\u0435\u0440\u0435\u0437 Google Data Studio, \u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u043e \u0431\u044b\u043b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0430\u0439\u0442 \u0431\u044b\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 iframe.\u00a0<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u00a0\u00a0\u041d\u043e \u044d\u0442\u043e \u0435\u0449\u0451 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0431\u0435\u0434\u044b. O\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u0442\u0447\u0451\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u0438, \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0441 \u0440\u043e\u0441\u0442\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u044d\u0442\u043e \u0432\u044b\u043b\u0438\u043b\u043e\u0441\u044c \u0431\u044b \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u00a0\u00a0\u041e\u0446\u0435\u043d\u0438\u0432 \u0432\u0441\u0435 \u043f\u043b\u044e\u0441\u044b \u0438 \u043c\u0438\u043d\u0443\u0441\u044b, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0435\u0437\u0436\u0430\u0442\u044c \u043d\u0430 \u0447\u0442\u043e-\u0442\u043e \u0441\u0432\u043e\u0451, \u0447\u0442\u043e-\u0442\u043e, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u043e\u0438\u0442\u044c \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u044b\u0445 \u0434\u0435\u043d\u0435\u0433, \u0438 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0438. \u0410 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ol>\n<li>\n<p>\u041c\u044b \u0445\u0440\u0430\u043d\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 BigQuery, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u0432 BigQuery \u043a\u043b\u0438\u0435\u043d\u0442\u0430 (\u0434\u0430\u043d\u043d\u044b\u0435-\u0442\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442) \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 OAuth2.0;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u0447\u0451\u0442\u043e\u0432, \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043d\u0430 2 \u0437\u0434\u043e\u0440\u043e\u0432\u0435\u043d\u043d\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e 20-30 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432 \u0441\u0442\u0440\u043e\u043a \u0441 10 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u0438 30 \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c\u0438 \u043a\u0430\u0436\u0434\u0430\u044f;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u043e\u0438\u0442 \u0434\u0435\u043d\u0435\u0433 \u0432 BigQuery, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 BigQuery;<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0432 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043e\u0442 \u043d\u0430\u0441.<\/p>\n<\/li>\n<\/ol>\n<p>\u00a0\u00a0\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f, \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Cube. \u041d\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u0438 \u0447\u0442\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430 TypeScript, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0412\u043e\u0442 \u0442\u0430\u043a Cube \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u043e\u0437\u0430\u0438\u043c\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0430 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 Cube):<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>  \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>API \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>Cube Refresh Worker \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u044e;<\/p>\n<\/li>\n<li>\n<p>Redis \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u0435\u0448 \u0438 \u0448\u0438\u043d\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0442\u0435\u0440 Cube Store \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u043d\u0438\u043c.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u00a0\u0422\u0443\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438. \u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0439 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0447\u0442\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u044b\u0448\u0435.<\/p>\n<p>\u00a0\u00a0Cube Store \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0444\u0430\u0439\u043b\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0430 parquet \u0438 \u0445\u043e\u0434\u0438\u0442 \u0432 \u043d\u0438\u0445 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u00a0\u00a0\u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0438 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Cube.<\/p>\n<h3>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043f\u0440\u043e Cube<\/h3>\n<p>\u00a0\u00a0\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u044b\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Cube, \u0442\u043e \u044d\u0442\u043e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e \u0445\u043e\u0434\u0443 \u043f\u043e\u0432\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u0441\u044c\u044f \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u044b, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a Cube.<\/p>\n<p>\u00a0\u00a0\u0412 Cube \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u0443\u0431\u043e\u0432 (\u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e), \u043a\u0443\u0431 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"javascript\">cube(`Users`, {  sql: `SELECT * FROM users`,    measures: {    count: {      sql: `id`,      type: `count`,    },  },    dimensions: {    city: {      sql: `city`,      type: `string`,    },      companyName: {      sql: `company_name`,      type: `string`,    },  }, });<\/code><\/pre>\n<p>\u00a0\u00a0\u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 sql-\u0437\u0430\u043f\u0440\u043e\u0441, 1 measure \u0438 2 dimension. \u0415\u0441\u043b\u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c, \u0442\u043e measure \u044d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0430 dimension &#8212; \u0442\u043e, \u043f\u043e \u0447\u0435\u043c\u0443 \u0445\u043e\u0442\u0438\u043c \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432 Cube \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"javascript\">{   dimensions: ['Users.city'],   measures: ['Users.count'] }<\/code><\/pre>\n<p>\u00a0\u00a0\u041d\u043e \u0445\u043e\u0434\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u043e\u0431\u043d\u043e, \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0440\u043e\u0433\u043e, \u0434\u0430 \u0438 \u0437\u0430\u0447\u0435\u043c, \u0435\u0441\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c. \u042d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0446\u0435\u0439 \u0438 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e Cube \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043a\u0443\u0431\u043e\u043c, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<\/p>\n<p>\u00a0\u00a0\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043a\u0443\u0431\u0435 \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">cube(`Orders`, {  sql: `SELECT * FROM users`,    ...,    preAggregations: {     usersByCity: {      dimensions: [CUBE.city],      measures: [CUBE.count],    },  }, }); <\/code><\/pre>\n<p>\u00a0\u00a0\u0422\u0430\u043a, \u043a\u0430\u043a \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c BigQuery, \u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 BigQuery. \u0423 Cube \u0441\u0443\u0449\u0435\u0442\u0441\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>\u0425\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0432 \u0431\u0430\u0437\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0421\u0442\u0440\u0438\u043c\u043e\u043c \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u044d\u0442\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 \u0431\u0430\u0437\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 Cube Store;<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c exportBucket, \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e BigQuery \u0441\u0430\u043c \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0444\u0430\u0439\u043b \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0432 CubeStore \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b.<\/p>\n<\/li>\n<\/ul>\n<p>\u00a0\u00a0\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0430\u043c\u0438\u043c \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438, \u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043d\u0430 \u0440\u0435\u043c\u0430\u0440\u043a\u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0435\u0433\u043e \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435.<\/p>\n<p>\u00a0\u00a0\u041a\u0430\u043a Cube \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0440\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435? \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 refreshKey:<\/p>\n<pre><code class=\"javascript\">refreshKey: {   every: `30 seconds`   sql: `SELECT MAX(created_at) FROM users`, }<\/code><\/pre>\n<p>\u00a0\u00a0Cube \u0440\u0430\u0437 \u0432 30 \u0441\u0435\u043a\u0443\u043d\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438.<\/p>\n<h3>OAuth2.0<\/h3>\n<p>\u00a0\u00a0\u0412 Cube \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u0435\u0441\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043b\u044f BigQuery, \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043d \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c\u0438, \u0430 \u0443 \u043d\u0430\u0441 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0447\u0435\u0440\u0435\u0437 OAuth 2.0 \u0441\u0438\u0434\u044f\u0442. \u0427\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c? \u0420\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435.<\/p>\n<pre><code class=\"typescript\">class SegmentStreamBigQueryDriver extends BigQueryDriver {  config: BigQueryDriverOptions;  constructor(config: BigQueryDriverOptions) {    super(config);      this.config = config;    this.pinoLogger = pinoLogger;      if (config.oauthCredentials) {      const refreshClient = new UserRefreshClient();        refreshClient.fromJSON({        type: 'authorized_user',        client_id: config.oauthCredentials.clientId,        client_secret: config.oauthCredentials.clientSecret,        refresh_token: config.oauthCredentials.refreshToken,        project_id: config.projectId,      });        this.bigquery.authClient.cachedCredential = refreshClient;    }  } }<\/code><\/pre>\n<p>\u00a0\u00a0\u041a\u0441\u0442\u0430\u0442\u0438, exportBucket \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 OAuth 2.0 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0441\u0441\u044b\u043b\u043e\u043a GCP \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u044e\u0447 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430, \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u0442 \u0434\u0435\u043b\u0430.<\/p>\n<h3>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/h3>\n<p>\u00a0\u00a0\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0442\u0430\u0451\u0442 \u0432\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a \u043d\u0430\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441 \u0444\u0440\u043e\u043d\u0442\u0430 \u043a\u0440\u0435\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 BQ, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438 \u043d\u0435 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0438\u043a\u0443\u0434\u0430? Cube \u0443\u043c\u0435\u0435\u0442 \u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0447\u0435\u0440\u0435\u0437 JWT, \u043d\u043e \u0432\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0448\u0451\u043b \u043e\u0442 \u0434\u043e\u0431\u0440\u043e\u0441\u043e\u0432\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0438 \u043a\u0440\u0435\u0434\u044b \u043e\u0442 BigQuery \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c.<\/p>\n<p>\u00a0\u00a0\u041c\u044b \u043d\u0435 \u0441\u0442\u0430\u043b\u0438 \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0441\u0443\u043d\u0443\u043b\u0438 \u0432 JWT \u043a\u0440\u0435\u0434\u044b, \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u0432 \u0438\u0445. \u041d\u043e \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043b\u043e\u0432\u0438\u043b\u0438 431 Request Header Fields Too Large<s> \u0438 \u043f\u043e\u0431\u0435\u0436\u0430\u043b\u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0441\u0442\u044b\u043b\u0438<\/s> \u0438 \u043f\u043e\u0448\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043b\u0430\u0433\u0438 \u043a \u043d\u043e\u0434\u0435 \u043d\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b \u044d\u0442\u043e \u0438 \u0441\u0430\u043c\u0438 \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"typescript\">interface EncodedCredentials {  content: string;  iv: string; } interface SecurityContext {  projectId: string;  datasetId: string;  oauthCredentials?: EncodedCredentials;  encodedServiceAccount?: EncodedCredentials; }<\/code><\/pre>\n<p>\u00a0\u00a0\u041a\u0442\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b \u043a\u043e\u0434, \u0442\u043e\u0442 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u044b \u0435\u0449\u0451 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043b\u0438. \u0414\u0430, \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c \u0433\u043e\u043d\u044f\u0442\u044c \u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0448\u0443 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 (BigQuery \u0443\u043c\u0435\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0432 \u0444\u0430\u0439\u043b \u0432 GCP, \u043d\u043e \u043a\u0430\u043a \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435, \u0443\u043c\u0435\u0435\u0442 \u043e\u043d \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0441\u0435\u0440\u0432\u0438\u0441-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u043c).<\/p>\n<p>\u00a0\u00a0\u0418\u0442\u043e\u0433\u043e, \u0432\u0441\u044f \u044d\u0442\u0430 \u043a\u0440\u0430\u0441\u043e\u0442\u0430 \u0441\u0442\u0430\u043b\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<ol>\n<li>\n<p>\u0424\u0440\u043e\u043d\u0442 \u0438\u0434\u0451\u0442 \u0432 API \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 JWT \u0434\u043b\u044f Cube, \u0432 JWT \u0437\u0430\u0448\u0438\u0442\u044b \u043a\u0440\u0435\u0434\u044b \u043e\u0442 BigQuery, \u0443 JWT, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u043f\u0438\u0441\u044c \u0438 \u0441\u0440\u043e\u043a \u0436\u0438\u0437\u043d\u0438;<\/p>\n<\/li>\n<li>\n<p>\u0421 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c JWT \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c \u0444\u0440\u043e\u043d\u0442 \u0438\u0434\u0451\u0442 \u0432 Cube;<\/p>\n<\/li>\n<li>\n<p>Cube \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044c JWT, \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u043a\u0440\u0435\u0434\u044b \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 SecurityContext;<\/p>\n<\/li>\n<li>\n<p>Cube \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0438 \u043e\u0442\u0434\u0430\u0451\u0442 \u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u00a0\u00a0\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Cube Refresh Worker (\u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043b\u0435\u0434\u0438\u0442, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0442\u044b) \u043c\u044b \u0438\u0437 API \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0431\u0435\u0437 \u0441\u0442\u0430\u0434\u0438\u0438 \u0437\u0430\u0448\u0438\u0432\u0430\u043d\u0438\u044f \u0432 JWT.<\/p>\n<h3>\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u043f\u043e\u043b\u044f updated_at<\/h3>\n<p>\u00a0\u00a0<a href=\"https:\/\/cube.dev\/docs\/caching\/pre-aggregations\/getting-started\" rel=\"noopener noreferrer nofollow\"><u>\u041f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438<\/u><\/a> \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u0430\u044f \u0432\u0435\u0449\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Cube Store: \u0448\u0442\u0443\u043a\u0435\u043d\u0446\u0438\u044f \u043d\u0430 Rust, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u0440\u0430\u043d\u0438\u0442 \u0438\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0443\u043c\u0435\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043e\u0442\u0442\u0443\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0445\u043e\u0434 BigQuery. Cube \u0443\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0441 \u0440\u0430\u0437\u043d\u043e\u0439 \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445, \u043d\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u043b\u044e\u0447 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438, \u043d\u043e \u043a\u043b\u044e\u0447\u0438\u043a\u0430-\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442.<\/p>\n<p>\u00a0\u00a0\u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0435\u0431\u044f\u0442\u0430 \u0438\u0437 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u043e\u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u043d\u0430\u043c \u043e\u0434\u0438\u043d \u0445\u0430\u043a:<\/p>\n<pre><code class=\"javascript\">granularity: `day`, partitionGranularity: `week`, buildRangeStart: { sql: `SELECT DATE_SUB(CURRENT_DATETIME(), INTERVAL 92 DAY)` }, buildRangeEnd: { sql: `SELECT CURRENT_DATETIME()` }, refreshKey: {  every: `5 minutes`,  sql: `SELECT COALESCE(max(last_modified_time), '2020-01-01T00:00:00.000Z') as last_updated_at        FROM \\`INFORMATION_SCHEMA.PARTITIONS\\`        where table_name = 'conversions'          AND partition_id != '__NULL__'          AND ${FILTER_PARAMS.Attribution.date.filter(            \"TIMESTAMP(PARSE_DATE('%Y%m%d', partition_id))\",          )}`, }<\/code><\/pre>\n<p>\u00a0\u00a0\u0412 BigQuery \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 (\u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u044b \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u043c).<\/p>\n<p>\u00a0\u00a0\u0410 \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u0440\u0443 \u043d\u0435\u0434\u0435\u043b\u044c \u043a \u043d\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u044b \u0441 \u0436\u0430\u043b\u043e\u0431\u0430\u043c\u0438 \u043d\u0430 \u0441\u043f\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u044b\u2026 \u0418 \u044d\u0442\u043e, \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0431\u044b\u043b\u043e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e: \u043a\u0430\u0436\u0434\u044b\u0435 5 \u043c\u0438\u043d\u0443\u0442 Cube \u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0440\u0435\u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438 \u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430 \u0441\u0443\u0442\u043a\u0438 \u043d\u0430\u0442\u0435\u043a\u0430\u043b\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0442\u0430\u043a. \u0410 \u0435\u0449\u0451 BigQuery \u0442\u0440\u0430\u0442\u0438\u0442 10 \u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 (\u043f\u043e\u0447\u0435\u043c\u0443 &#8212; \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0432\u043e\u043f\u0440\u043e\u0441), \u0438 \u0437\u0430 \u043c\u0435\u0441\u044f\u0446 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043a\u0430\u043f\u0430\u0442\u044c \u043f\u043e\u0434 \u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442.<\/p>\n<p>\u00a0\u00a0\u0418\u0442\u0430\u043a, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0448\u0430\u0442\u044c. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0430\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u044d\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043c\u044b \u0438<\/p>\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-339146","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339146","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=339146"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339146\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}