This commit is contained in:
shenjian@fangjia.com
2023-04-21 11:35:25 +08:00
parent 2a9fa3574f
commit b915e1fe1b
2 changed files with 35 additions and 1 deletions
+22 -1
View File
@@ -43,4 +43,25 @@ INSERT INTO etl.dwm_company(
clickhouse-client --format_csv_delimiter="|" --input_format_with_names_use_header=0 --query="INSERT INTO etl.dwd_company FORMAT CSVWithNames" --host=192.168.0.216 --password=goojia123456 < company.csv
# 导出company.csv
clickhouse-client --password goojia123456 -d etl -q "select * from company FORMAT CSVWithNames" --format_csv_delimiter='|' > company.csv
clickhouse-client --password goojia123456 -d etl -q "select * from company FORMAT CSVWithNames" --format_csv_delimiter='|' > company.csv
CREATE TABLE etl.company_local ON CLUSTER fangjia
(
district String,
ent_name String,
reg_addr String,
unified_code String,
authority String
) ENGINE=MergeTree PARTITION BY substring(unified_code, 2, 2) PRIMARY KEY(unified_code) ORDER BY (unified_code)
CREATE TABLE etl.company_shard ON CLUSTER fangjia
(
district String,
ent_name String,
reg_addr String,
unified_code String,
authority String
) ENGINE=Distributed(fangjia, etl, company, hiveHash(substring(unified_code, 2, 2)))
clickhouse-client --format_csv_delimiter="|" --input_format_with_names_use_header=0 --query="INSERT INTO etl.company_shard FORMAT CSVWithNames" --input_format_allow_errors_ratio=0.3 --host=192.168.0.216 --password=goojia123456 < td_gov_company_basic.csv
+13
View File
@@ -0,0 +1,13 @@
create table fangjia.region (
province_code String,
fangjia_province String,
province_name String,
city_code String,
city_name String,
fangjia_city String,
region_code String,
fangjia_area String,
region_name String
)
ENGINE MergeTree()
PARTITION BY province_code PRIMARY KEY (region_code) ORDER BY (region_code);