pgloader 基本使用

导入csv:

--type: 导入文件类型

--field: 导入表的字段

--with truncate:每次先删除表全部记录再新增,如果每次是增量导入,则不需要增加此选项

--with "fields terminated by ','":字段值通过,分隔

实例1:

pgloader --type csv 
--field "requirement_num,demand_schema_id,planning_schema_id,demand_state,period,construction_type_key,coverage_type_key,city_key,area_key,network_type_key,station_type_key,station_name,band,subordinate_area,subordinate_mesh,demand_longitude,demand_latitude,demand_radius,demand_reason,coverage_importance,demand_type,construction_type,construction_batch,construction_model,coverage_type,scene_type,coverage_range,coverage_scene,building_quantity,average_floor_num,detailed_address,is_transfer_reached,region_graph,region_area,problem_point_sn,problem_point_type,problem_line,gsm_cosite_planning_period,gsm_cosite_sitename,gsm_cosite_position,gsm_coaddress_station_status,td_cosite_planning_period,td_cosite_sitename,td_cosite_position,td_coaddress_station_status,lte_cosite_planning_period,lte_cosite_sitename,lte_cosite_position,lte_coaddress_station_status,td_scdma_cosite_sitename,other_cositename,regional_gsm_macro_traffic,regional_td_macro_traffic,regional_lte_macro_traffic,gsm_coverage_rate,gsm_rxlev,lte_coverage_rate,lte_rsrp,lte_rs_sinr,average_traffic,demand_site_source,peripheral_cell_count,station_type_coefficient,scene_factor,is_reserved_planning,creator,create_time,modifier,modify_time"
--with truncate --with "fields terminated by ','"
/home/adminz/Documents/pgloader/NPA_DE_COVER_POINT.csv
postgres://postgres:[email protected]:25432/npas?tablename=public.npa_de_cover_point

实例中:

source为源文件:“/home/adminz/Documents/pgloader/NPA_DE_COVER_POINT.csv"

target为目标表: “postgres://postgres:[email protected]:25432/npas?tablename=public.npa_de_cover_point”

 

实例2:

pgloader --type csv --field 
"CUID,\"E-UTRANCELL名称\",网管中网元名称,所属省,所属地市,所属区县,小区码CI,跟踪区码TAC,\"所属E-NODEBID\",\"所属E-NODEB\",\"所属机房/资源点\",生命周期状态,是否拉远小区,使用频段,覆盖类型,上下行子帧配比,特殊子帧时隙配比,PCI,覆盖场景,覆盖场景细化,入网时间,覆盖区域,中心载频的信道号,小区CGI,工程期数,创建时间,最后修改时间,创建人,最后修改人,所属类型,纬度,经度,路测纬度,路测经度,VIP级别,最后加入白名单时间,备注,最后采集时间,所属发射点,数据质量责任人,一线数据维护人,优化网格" 
-L "/home/adminz/Documents/csv/log/v_irms_mt_wireless_ltecell.log" 
--with truncate --with "skip header = 1" --with "batch rows=10000" 
--with "fields terminated by ','" 
/home/adminz/Documents/csv/V_IRMS_MT_WIRELESS_LTECELL.csv 
postgres://postgres:[email protected]:35432/npas055?tablename=zongzi.v_irms_mt_wireless_ltecell

 

参考资料:

https://pgloader.readthedocs.io/en/latest/quickstart.html

猜你喜欢

转载自blog.csdn.net/londa/article/details/108065253