为什么显示错误列数错误!从包含以下内容的源文件中复制99列:FEWER列

时间:2017-08-24 09:03:20

标签: python vertica

为什么显示错误列数错误!从包含以下内容的源文件中复制99列:FEWER columns.Tried到COPY和加载器返回错误,但我计算正常加载的行中的列 - 99和拒绝行99中的列。

详情: 有桌子:

  create table ALL_EVENTS
(
id VARCHAR(500) not null,
version NUMBER(10) not null,
title Long Varchar,
description Long Varchar,
solution Long Varchar,
state VARCHAR(500),
severity VARCHAR(500),
priority VARCHAR(500),
category VARCHAR(500),
subcategory VARCHAR(500),
type VARCHAR(500),
related_ci_hint Long Varchar,
om_service_id Long Varchar,
related_ci_id VARCHAR(500),
related_ci_type VARCHAR(500),
node_id VARCHAR(500),
node_type VARCHAR(500),
sequence_number NUMBER(19),
nodehints_hint VARCHAR(8000),
nodehints_dnsname VARCHAR(500),
nodehints_ipaddress VARCHAR(500),
nodehints_coreid VARCHAR(500),
sourcecihints_hint Long Varchar,
sourcecihints_dnsname VARCHAR(500),
sourcecihints_ipaddress VARCHAR(500),
sourcecihints_coreid VARCHAR(500),
originating_dnsname VARCHAR(500),
originating_ipaddress VARCHAR(500),
originating_coreid VARCHAR(500),
sending_dnsname VARCHAR(500),
sending_ipaddress VARCHAR(500),
sending_coreid VARCHAR(500),
om_user VARCHAR(500),
assigned_user NUMBER(10),
assigned_group NUMBER(19),
cause_id VARCHAR(500),
time_created TIMESTAMP(6),
time_changed TIMESTAMP(6),
time_state_changed TIMESTAMP(6),
time_received TIMESTAMP(6) not null,
duplicate_count NUMBER(10),
eti_hint VARCHAR(500),
eti_subcomponent_id VARCHAR(500),
ua_host_dnsname VARCHAR(500),
ua_host_ipaddress VARCHAR(500),
ua_host_coreid VARCHAR(500),
ua_call Long Varchar,
ua_status VARCHAR(500),
ua_add_anno NUMBER(1),
ua_will_resolve NUMBER(1),
aa_host_dnsname VARCHAR(500),
aa_host_ipaddress VARCHAR(500),
aa_host_coreid VARCHAR(500),
aa_call Long Varchar,
aa_status VARCHAR(500),
aa_add_anno NUMBER(1),
aa_will_resolve NUMBER(1),
application VARCHAR(500),
object VARCHAR(500),
event_key Long Varchar,
close_key_pattern Long Varchar,
original_data Long Varchar,
log_only NUMBER(1),
no_dedup NUMBER(1),
received_on_ci_downtime NUMBER(1),
instruction_available NUMBER(1),
source_ci_id VARCHAR(500),
source_ci_type VARCHAR(500),
policy_type VARCHAR(500),
policy_name VARCHAR(500),
condition_id VARCHAR(500),
condition_name VARCHAR(500),
original_id VARCHAR(500),
correlation_type VARCHAR(500),
correlation_rule_id VARCHAR(500),
correlation_weight VARCHAR(500),
eti_indicator_id VARCHAR(500),
eti_value_id VARCHAR(500),
eti_reset_value_id VARCHAR(500),
eti_numeric_value FLOAT,
control_dnsname VARCHAR(500),
control_server_port NUMBER(10),
control_server_id VARCHAR(500),
control_external_id VARCHAR(500),
control_external_url VARCHAR(500),
rule_name VARCHAR(500),
transfer_state VARCHAR(500),
initiated_by_id NUMBER(10),
source_dnsname VARCHAR(500),
source_ia_management_port NUMBER(10),
source_ia_management_protocol VARCHAR(500),
source_server_id VARCHAR(500),
source_external_id VARCHAR(500),
source_external_url VARCHAR(500),
cires_hint_count NUMBER(10),
cires_matched_hint_count NUMBER(10),
cires_quality_metric NUMBER(10),
cires_status Long Varchar,
received_as_notify NUMBER(1)
)
PARTITION BY EXTRACT (MONTH FROM time_received) 
;

示例

"2ba84514-400d-71e7-1e5f-0a4805420000";"1";"Many files in catalog «C:\oris\UPS\!Unrecognized\:.*» = 1, upper threshold 1";"MSK host01 Count files in catalogies «C:\oris\SUPS\!Unrecognized\:.*» = 1, upper threshold 1 ORIS OS";"";"CLOSED";"MINOR";"MEDIUM";"BASIC_SITESCOPE_EVENT (Directory)";"Catalogies - count files include catalogies:DIR_FilesCount:C:\oris\UPS\!Unrecognized\:.*";"Working ТМ";"file_share:""C:\oris\UPS\!Unrecognized\""@@host01";"SiteScopeMonitor:1227687353:1227687355@@host01";"7f8021ea247d965c4092f41d63ac9577";"fileshare";"912bba5b7fd438e480385a54bbbda39f";"nt";"158963838";"host01|192.168.0.1";"host01";"192.168.0.1";"";"SiteScope@@sitescope01";"sitescope01";"192.168.0.1";"f955cb42-6ba0-7586-1f18-942c652caf25";"HPBSMAPPHOST";"192.168.0.1";"";"";"";"";"";"29";"602";"";"2017-05-23 23:11:36";"2017-06-16 06:23:58.725000";"2017-06-16 06:23:58.378000";"2017-05-23 23:11:37.109000";"0";"System_Performance:MINOR";"Catalogies - count files include all folders:DIR_FilesCount:C:\oris\!Unrecognized\:.*";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"ORIS OSS";"SiteScope:Sitescope01:Gadukino: ORIS OS: host01: Catalogies: [C:~oris~UPS~P~R~!Unrecognized~:.*]:DIR_FilesCount";"sitescope01:b8ef0f50-403f-46c6-84d4-bfe0bc498b9c:Alert:";"sitescope01:b8ef0f50-403f-46c6-84d4-bfe0bc498b9c:Alert<*>";"Gadukino
: 24.05.2017 02:11:36 MSK
Host: host01
Title: Count files in folder «C:\oris\UPS\!Unrecognized\:.*» = 1, upper threshold 1
System: ORIS OS
ID TM: 10091000
URL by TM: http://superorders/monpoint/OpenMonPoint.jsf?id=10091000
Scheduler time: 00:00-23:59XSan,Mon
Emergensy team: Capitan America,Iron Man,АМ
URL Emergency: http://duty/DutyList/web/DutyList.jsf?groupId=399991500
Event ID: 2ba84514-400d-71e7-1e5f-0a4805420000
URL by event: https://hpbsm/opr-web/opr-evt-details?eventId=2ba84514-400d-71e7-1e5f-0a4805420000
List operations for duty team: If you got Healph event ""Heartbeat"" create incident on emegensy team Microsoft
URL by IMS: https://ims/view.asp?BLOCK=MAIN&ID=696000";"0";"0";"1";"0";"763af755a18d79de43e89ba5769df2c5";"nt";"LOGFILE";"HP_SiteScope_to_Operations_Manager_Integration_by_Log_File(2.0)";"745e8014-256a-40aa-a94e-ebd42309d47d";"Forward Minor SiteScope information";"";"";"";"";"61de81eb-72a7-4158-abc4-f7b96819e952";"c80faaae-96f3-464f-aed5-8fe74444eef6";"86e9b0b4-2173-456f-aefe-db7a132e9bc8";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"4";"3";"75";"Success: Hint ""file_share:""C:\oris\UPS\!Unrecognized\""@@host01"" resolved.";"0"

python脚本

with open(file_name, "rb") as fs:
    my_file = fs.read()

cursor.copy("COPY %s.%s FROM stdin PARSER fcsvparser(type='traditional', delimiter=';', record_terminator='\n') REJECTED DATA '/home/dbadmin/temp/rejected_data_%s.txt' EXCEPTIONS '/home/dbadmin/temp/exceptions_%s.txt'" %(SCHEMA_NAME, TABLE_NAME, TABLE_NAME, TABLE_NAME),my_file)

请帮助找到解决此问题的方法。

1 个答案:

答案 0 :(得分:0)

确实选择了fjsonparser变种

例如

cursor.copy("copy %s.%s from stdin parser fjsonparser() REJECTED DATA '/home/dbadmin/temp/rejected_data_%s.txt' EXCEPTIONS '/home/dbadmin/temp/exceptions_%s.txt'" %(SCHEMA_NAME, TABLE_NAME, TABLE_NAME, TABLE_NAME),json_file)