{"id":5160,"date":"2024-07-31T20:48:57","date_gmt":"2024-07-31T12:48:57","guid":{"rendered":"http:\/\/xinblog.ltd\/?p=5160"},"modified":"2024-08-20T21:13:14","modified_gmt":"2024-08-20T13:13:14","slug":"1-superset%e7%9a%84%e5%90%af%e5%8a%a8","status":"publish","type":"post","link":"http:\/\/xinblog.ltd\/?p=5160","title":{"rendered":"1.Superset\u7684\u542f\u52a8"},"content":{"rendered":"<p>Part 1. Superset\u7684\u542f\u52a8<\/p>\n<p>\u5173\u4e8eSuperset\uff0c\u8fd9\u4e2a\u4ee5Python\u4f5c\u4e3a\u7f16\u7a0b\u8bed\u8a00\uff0c\u4ee5Flask\u4f5c\u4e3a\u6846\u67b6\uff0c\u96c6\u6210Sqlachemy\u7b49\u7ec4\u4ef6\u7684\u9879\u76ee\u3002\u5176\u542f\u52a8\u65b9\u5f0f\u548c\u5176\u4ed6python\u6846\u67b6\u7c7b\u4f3c\uff0c\u672c\u7ae0\uff0c\u6211\u4eec\u5c06\u4e66\u5199\u5982\u4f55\u542f\u52a8Superset\uff0c\u5e76\u5229\u7528Pycharm\u5c06\u5176\u542f\u52a8\u8d77\u6765\u3002<\/p>\n<ol>\n<li>\u4e0b\u8f7dSuperset<\/li>\n<\/ol>\n<p>\u8981\u4e0b\u8f7dSuperset\u5fc5\u7136\u79bb\u4e0d\u5f00\u5176Github\u4ed3\u5e93\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\u5fc5\u7136\u4e3a<\/p>\n<p>git clone <a href=\"https:\/\/github.com\/apache\/superset\">https:\/\/github.com\/apache\/superset<\/a><\/p>\n<p>\u90a3\u4e48\u5728\u4e0b\u8f7d\u5b8c\u6210\u4e4b\u540e\uff0c\u8fdb\u5165\u76f8\u5173\u7684folder<\/p>\n<p>cd superset<\/p>\n<p>\u5e76\u521b\u5efa\u597d\u76f8\u5173\u7684\u865a\u62df\u73af\u5883\uff0c\u65b9\u4fbf\u540e\u7eed\u5b89\u88c5\u76f8\u5173\u7684\u4f9d\u8d56<\/p>\n<p>python -m venv venv<\/p>\n<p>\u542f\u52a8\u865a\u62df\u73af\u5883<\/p>\n<p>source venv\/bin\/activate<\/p>\n<p>\u4e4b\u540e\u4fbf\u662f\u5b89\u88c5\u4f9d\u8d56\uff0c\u9700\u8981\u6ce8\u610fWindow\u7535\u8111\u5b89\u88c5\u53ef\u80fd\u9700\u8981C++\u73af\u5883\uff0cmac\u76f8\u5bf9\u7b80\u5355<\/p>\n<p>pip install -r requirements\/testing.txt<\/p>\n<p>pip install -e .<\/p>\n<p>\u4e4b\u540e\u4fbf\u662f\u521d\u59cb\u5316superset<\/p>\n<p>superset db upgrade<\/p>\n<p>superset fab create-admin<\/p>\n<p>superset init<\/p>\n<p>superset load-examples #\u8fd9\u4e00\u6b65\u9009\u505a\uff0c\u53ea\u662f\u586b\u5145\u4e00\u4e9b\u9ed8\u8ba4\u6570\u636e<\/p>\n<p>\u5176\u9ed8\u8ba4\u4f1a\u94fe\u63a5\u672c\u673a\u7684\u4e00\u4e2asqllite\u6570\u636e\u5e93<\/p>\n<p>\u5982\u679c\u4e0d\u5e0c\u671b\u4f7f\u7528\u9ed8\u8ba4\u7684sqllite\u6570\u636e\u5e93\uff0c\u6216\u8005\u6709\u81ea\u5df1\u7684mysql\uff0cpostgresql\u7b49\u7ed3\u6784\u5316\u6570\u636e\u5e93\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539config.py\u4e2d\u7684SQLALCHEMY_DATABASE_URI\u8fdb\u884c\u4fee\u6539<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"860\" height=\"46\" class=\"wp-image-5161\" src=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2024\/06\/word-image.png\" srcset=\"http:\/\/xinblog.ltd\/wp-content\/uploads\/2024\/06\/word-image.png 860w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2024\/06\/word-image-300x16.png 300w, http:\/\/xinblog.ltd\/wp-content\/uploads\/2024\/06\/word-image-768x41.png 768w\" sizes=\"(max-width: 860px) 100vw, 860px\" \/><\/p>\n<p>\u540c\u65f6\u4e5f\u9700\u8981\u9ed8\u8ba4\u7684sqllite\u7248\u672c\u53ef\u80fd\u6709\u95ee\u9898\u5bfc\u81f4\u65e0\u6cd5\u4fdd\u5b58\uff0c\u53ef\u4ee5\u5728\u9ed8\u8ba4\u7684\u94fe\u63a5\u540e\u589e\u52a0<\/p>\n<p>&#8220;?check_same_thread=False&#8221;\uff0c\u89e3\u51b3\u3002<\/p>\n<p>\u521d\u59cb\u5316\u5b8c\u6210\u6570\u636e\uff0c\u5373\u53ef\u542f\u52a8\u540e\u7aef\u4ee3\u7801\uff0c\u5982\u679c\u76f4\u63a5\u542f\u52a8\uff0c\u90a3\u4e48\u5229\u7528\u5982\u4e0b\u547d\u4ee4\u5373\u53ef<\/p>\n<p>export FLASK_ENV=development<\/p>\n<p>superset run -p 8088 &#8211;with-threads &#8211;reload \u2013debugger<\/p>\n<p>\u5982\u679c\u9700\u8981\u8fd0\u884c\u5728Pycharm\u4e4b\u4e2d\uff0c\u90a3\u4e48\u9700\u8981\u5728\u5176\u4e0a\u914d\u7f6e\u4e00\u4e2aDebug configuration\uff0c\u53c2\u6570\u5982\u4e0b<\/p>\n<p>script path: {project_root}\/venv\/bin\/flask<br \/>\nparameters: run -p 8088 &#8211;with-threads &#8211;reload &#8211;debugger<br \/>\nEnvironment variables: FLASK_APP=superset;FLASK_ENV=development<br \/>\n\u6700\u540e\u5728run\u4e2d\u9009\u62e9\u5f53\u524d\u6587\u4ef6\u5939\u4e0bvenv\u865a\u62df\u73af\u5883\u7684\u89e3\u91ca\u5668\u3002Pycharm\u4f1a\u9ed8\u8ba4\u8bfb\u53d6\u5230\uff0c\u5982\u679c\u6ca1\u80fd\u8bfb\u53d6\u5230\uff0c\u5219\u9700\u8981\u6211\u4eec\u5728setting\u4e2d\u65b0\u589eExisting environment\u7684\u89e3\u91ca\u5668\u5373\u53ef\u3002<\/p>\n<p>\u90a3\u4e48\u8fd0\u884c\u4e2d\u770b\u89c1<\/p>\n<p>Running on http:\/\/127.0.0.1:8088 (Press CTRL+C to quit)<\/p>\n<p>\u8bf4\u660e\u5df2\u7ecf\u8fd0\u884c\u6210\u529f\u4e86\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u6211\u4eec\u8fd0\u884c\u524d\u7aef\u3002<\/p>\n<p>\u6211\u4eec\u5229\u7528nvm\u6765\u7ba1\u7406nodejs\u7248\u672c<\/p>\n<p>\u5e76\u63d0\u524d\u5b89\u88c5\u597dnpm\u7248\u672c<\/p>\n<p>\u63a5\u4e0b\u6765\u8fdb\u5165 superset-frontend\u6587\u4ef6\u5939\u8fdb\u884c\u5b89\u88c5<\/p>\n<p>cd superset-frontend<br \/>\nnvm install &#8211;lts<br \/>\nnvm use &#8211;lts<\/p>\n<p>npm ci<br \/>\nnpm run dev-server<\/p>\n<p>\u4fee\u6539\u8fde\u63a5\u7684\u540e\u7aef\u4fe1\u606f\u53ef\u4ee5\u5728<\/p>\n<p>webpack.proxy-config.js\u4e2d\u4fee\u6539backend\u5e38\u91cf\u751f\u6548\u3002<\/p>\n<p>\u8fd9\u6837\u5c31\u53ef\u4ee5\u542f\u52a8\u6211\u4eec\u7684superset\uff0c\u5e76\u8fdb\u884c\u76f8\u5173\u7684\u8c03\u8bd5\u4e86<\/p>\n<p>\u8bbf\u95ee<a href=\"http:\/\/localhost:9000\/\">http:\/\/localhost:9000\/<\/a>\u5373\u53ef\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 1. Superse [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"_links":{"self":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts\/5160"}],"collection":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5160"}],"version-history":[{"count":1,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts\/5160\/revisions"}],"predecessor-version":[{"id":5162,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=\/wp\/v2\/posts\/5160\/revisions\/5162"}],"wp:attachment":[{"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5160"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinblog.ltd\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}