对于DATE类型值,Netezza插入失败

时间:2014-05-07 04:41:19

标签: date insert netezza

问题说明:

query = insert into tbl_test ("id", "date_col") values (?, ?)
cursor.executemany(query, [(1,'1955-05-20'), (1,'1955-05-20'),])

错误消息:

  

内部错误:执行查询时出错请求已取消查询“   INSERT INTO“TBL_TEST”(“id”,“date_col”)VALUES(?,?)“'

nzlog: 负载开始于:美国东部时间06-May-14 22:24:39

  Database:         demo
  Tablename:        TBL_TEST
  Datafile:         /dev/null
  Host:             netezza

加载选项

Field delimiter:       '\t'               NULL value:            NULL
  File Buffer Size (MB): 8                  Load Replay Region (MB): 0
  Encoding:              INTERNAL           Max errors:            1
  Skip records:          0                  Max rows:              0
  FillRecord:            No                 Truncate String:       No
  Escape Char:           '\'                Accept Control Chars:  Yes
  Allow CR in string:    Yes                Ignore Zero:           No
  Quoted data:           NO                 Require Quotes:        No

  BoolStyle:             1_0                Decimal Delimiter:     '.'

  Disable NFC:           No
  Date Style:            YMD                Date Delim:            '-'
  Time Style:            24HOUR             Time Delim:            ':'
  Time extra zeros:      Yes

发现不良记录

错误#:输入行#(检查的最后一个字符的字节偏移量)[字段#,声明]诊断,“消耗的文本”[最后检查的字符]

1: 1(2) [2, DATE] contents of field, ""[{]

统计

  number of records read:      1
  number of bad records:       1
  -------------------------------------------------
  number of records loaded:    0

=============================================== ==============================

nzbad:

 1   {d '1955-05-20'}

表格“TBL_TEST”

 Attribute |  Type   | Modifier |   Default Value
-----------+---------+----------+--------------------
 id        | INTEGER | NOT NULL | -1
 date_col  | DATE    |          | '2013-01-01'::DATE
Distributed on hash: "id"

根据@Varun Bajaj的建议,通过nzload命令重现问题:

nzload -u <userName> -pw <password> -db <database> -t <tableName> -delim , -df test.csv -host <hostIP> -bf testbf.log -lf testlf.log

test.csv

'1','1955-05-20'
'2','1955-05-21'

testlf.log

Load started at:07-May-14 05:13:35 EDT

  Database:         demo
  Tablename:        TBL_TEST
  Datafile:         /home/nz/test.csv
  Host:             netezza

Load Options

  Field delimiter:       ','                NULL value:            NULL
  File Buffer Size (MB): 8                  Load Replay Region (MB): 0
  Encoding:              INTERNAL           Max errors:            1
  Skip records:          0                  Max rows:              0
  FillRecord:            No                 Truncate String:       No
  Escape Char:           None               Accept Control Chars:  No
  Allow CR in string:    No                 Ignore Zero:           No
  Quoted data:           NO                 Require Quotes:        No

  BoolStyle:             1_0                Decimal Delimiter:     '.'

  Disable NFC:           No
  Date Style:            YMD                Date Delim:            '-'
  Time Style:            24HOUR             Time Delim:            ':'
  Time extra zeros:      No

Found bad records

bad #: input row #(byte offset to last char examined) [field #, declaration] diagnostic, "text consumed"[last char examined]
----------------------------------------------------------------------------------------------------------------------------
1: 1(2) [2, DATE] contents of field, ""[']

Statistics

  number of records read:      1
  number of bad records:       1
  -------------------------------------------------
  number of records loaded:    0

  Parsing Time (sec): 1.0
  Elapsed Time (sec): 1.0

-----------------------------------------------------------------------------
Load completed at: 07-May-14 05:13:36 EDT
=============================================================================

testbf.log

'1','1955-05-20'

0 个答案:

没有答案