从pg里面导出数据////将数据导出到pg,不要在本地,在黑窗口里面,原因-思考???

sc@sc-All-Series:~$ psql -h 192.168.31.157 -p 5432 #有误,正确见下面。
Password: 
psql: FATAL:  password authentication failed for user "sc"
FATAL:  password authentication failed for user "sc"
sc@sc-All-Series:~$ psql -h 192.168.31.157 -p 5432 decision_engine_dev  postgres
Password for user postgres: 
psql (9.5.12, server 9.5.3)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

decision_engine_dev=# use
decision_engine_dev-# \COPY t_shixin_predict_features TO '/home/sc/Downloads/staticdata/t_shixin_predict_features.csv' WITH csv;
COPY 493719
decision_engine_dev-# 


\COPY t_shixin_predict_features(company_name,established_years,industry_dx_rate,regcap_change_cnt,industry_dx_cnt,address_change_cnt,network_share_cancel_cnt,cancel_cnt,fr_change_cnt,network_share_zhixing_cnt,judgedoc_cnt,network_share_judge_doc_cnt,bidding_cnt,trade_mark_cnt,judge_doc_cnt,share_change_cnt,industry_all_cnt,shixin_label ) TO '/home/sc/Downloads/staticdata/t_shixin_predict_features.csv' WITH csv;


select * from public.t_add_shixin_predict_features;
select count(*) as num from public.t_add_shixin_predict_features;
select * from public.t_add_shixin_predict_features where id = '6f61cf38-5e0c-11e8-8ebe-9c5c8e925e38';
delete from t_add_shixin_predict_features where id = '6f61cf38-5e0c-11e8-8ebe-9c5c8e925e38';
select count(distinct(id)) as num  from t_add_shixin_predict_features;
copy (select *  from t_add_shixin_predict_features a
 where a.company_name not in (select company_name from t_shixin_predict_features)) to '/home/sc/PycharmProjects/risk-model/xg_test/statis_data/lost_shixin_company_name.csv' with csv header;

将本地csv数据导入到pg:
删掉换行符;
加\copy;而不是copy;
登录进数据库了之后,不需要use;
\copy shixin_offline_predict_results (id,create_time,update_time,company_name,shixin_label,rank,big_hy_name,shixin_prob,risk_type,sub_rank)
from '/home/sc/PycharmProjects/risk-model/scpirt/test_build_data_scripts/hy_chuli_shixin_db_dataset.csv' with csv header;



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值