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;
从pg里面导出数据////将数据导出到pg,不要在本地,在黑窗口里面,原因-思考???
最新推荐文章于 2024-08-21 15:26:42 发布