{"id":427070,"date":"2021-04-13T17:28:17","date_gmt":"2021-04-13T09:28:17","guid":{"rendered":"http:\/\/4563.org\/?p=427070"},"modified":"2021-04-13T17:28:17","modified_gmt":"2021-04-13T09:28:17","slug":"%e5%9b%b0%e6%83%91%e3%80%82%e4%b8%80%e4%b8%aa-clickhouse-%e7%9a%84%e5%91%bd%e4%bb%a4%e5%ad%97%e7%ac%a6%e4%b8%b2%e8%a6%81%e6%80%8e%e4%b9%88%e5%86%99%e6%89%8d%e6%98%af%e6%ad%a3%e7%a1%ae%e7%9a%84","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=427070","title":{"rendered":"\u56f0\u60d1\u3002\u4e00\u4e2a clickhouse \u7684\u547d\u4ee4\u5b57\u7b26\u4e32\u8981\u600e\u4e48\u5199\u624d\u662f\u6b63\u786e\u7684\u5462\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u56f0\u60d1\u3002\u4e00\u4e2a clickhouse \u7684\u547d\u4ee4\u5b57\u7b26\u4e32\u8981\u600e\u4e48\u5199\u624d\u662f\u6b63\u786e\u7684\u5462\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sjmcefc2 <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>clickhouse-client &#8211;format_csv_delimiter=&#8221;^C&#8221; &#8211;query=&#8221;INSERT INTO tutorial.TABLE FORMAT CSV&#8221; &lt; CSV.txt<\/p>\n<p>\u60f3\u7740\u628a\u4e0a\u9762\u7684\u547d\u4ee4\u5199\u5230 python \u7684 call \u4e2d\uff0c\u5e94\u8be5\u600e\u4e48\u5199\u624d\u80fd\u6b63\u786e\u8c03\u7528\u5462\uff1f\u201c\u201d\u8fd9\u79cd\u5b57\u7b26\u4e32\u603b\u662f\u4f1a\u65ad\u6389\u6b63\u5e38\u7684\u89e3\u6790\u3002\u7528 r \u4e5f\u8c8c\u4f3c\u6ca1\u6709\u7528\u5904\u3002 \u6216\u8005\u8c03\u7528\u8fd9\u6837\u7684\u547d\u4ee4\u8fd8\u6709\u4ec0\u4e48\u6bd4\u8f83\u597d\u7684\u65b9\u5f0f\u5462\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5735435\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NilChan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u6210\u4e86 clubhouse                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5735436\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : sjmcefc2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u89c9\u5e94\u8be5\u662f^C \u8fd9\u4e2a\u7b26\u53f7\uff0c\u662f\u4e0d\u662f\u8981\u8f6c\u4e49\u5462                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5735437\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yzwduck <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5bf9\u4e8e\u590d\u6742\u7684\u547d\u4ee4\u884c\uff0c\u6211\u89c9\u5f97\u76f4\u63a5\u4f20\u9012\u53c2\u6570\u6570\u7ec4\u4f1a\u5bb9\u6613\u4e00\u4e9b\uff0c\u8f6c\u4e49\u4ea4\u7ed9 Python \u6765\u505a\u3002<br \/>PS: \u6211\u6ca1\u6709 clickhouse \u73af\u5883\uff0c\u6240\u4ee5\u6ca1\u6d4b\u8bd5\u8fc7\u662f\u5426\u6b63\u786e\u3002<\/p>\n<p>fobj = open(&#8216;CSV.txt&#8217;, &#8216;rb&#8217;)<br \/>p = subprocess.call([&#8216;clickhouse-client&#8217;, &#8216;&#8211;format_csv_delimiter=^C&#8217;, &#8216;&#8211;query=INSERT INTO tutorial.TABLE FORMAT CSV&#8217;], stdin=fobj)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5735438\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : sjmcefc2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @yzwduck \u8fd9\u4e2a\u63d0\u793a&#8211;format_csv_delimiter=&#8221;&#8221; &#8211;query= &#8220;INSERT INTO tutorial.table FORMAT CSV &#8220;&lt; \/home\/ja\/data\/data\/csv.txt<br \/>Code: 19. DB::Exception: A setting&#8217;s value string has to be an exactly one character long                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u56f0\u60d1\u3002\u4e00\u4e2a clickhouse &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/427070"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=427070"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/427070\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=427070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=427070"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=427070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}