将数据从csv文件导入IBM netezza sql数据库时出错 [英] error of importing data from csv file to IBM netezza sql database

查看:386
本文介绍了将数据从csv文件导入IBM netezza sql数据库时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过Aginity Netteza工作台将csv文件(122 GB,所有字段都是整数或字符串)导入IBM netezza sql数据库中的表。

I need to import a csv file (122 GB, all fields are integer or string) to a table on IBM netezza sql database through Aginity Netteza workbench.

I创建了包含名称与csv文件中的名称匹配的字段的表。

I have created the table with fields that names match with ones in the csv file.

当我导入数据时出错:

 Unable to export the data to a file. Error: required option for internal format is not set: Compress

我很困惑,因为我在做导入而不是出口。这是我的SQL查询:

I am confused because I am doing import not export. This is my sql query:

  CREATE TABLE my_table
  (
    id integer ,
    value1 integer ,
    value2 character varying(2) ,
    value3 integer ,
    value4 character varying(32) ,
    value5 integer ,
    value6 double precision
  ); 


   INSERT INTO my_table
   SELECT * FROM 
   EXTERNAL 'E:\\my_path\\my_file.csv'
   USING
   (
      DELIMITER ','
      LOGDIR 'C:\\my_log'
      Y2BASE 2000
      ENCODING 'internal'
      SKIPROWS 1
      REMOTESOURCE 'ODBC'
      ESCAPECHAR '\'
   )

任何帮助都将是赞赏。

Any help would be appreciated.

谢谢

推荐答案

这是一个误导错误文本的案例,我认为。如果要从CSV导入,则应使用Text作为FORMAT。它看起来好像是默认为内部,这不是你想要的。尝试将FORMAT'text'添加到USING部分以明确说明您正在使用文本文件。

This is a case of misleading error text, I think. If you are importing from a CSV then you should be using Text as the FORMAT. It looks as if it is defaulting to 'internal' which is not what you want. Try adding FORMAT 'text' to the USING section to explicitly state you are working with a text file.

INSERT INTO my_table
   SELECT * FROM 
   EXTERNAL 'E:\\my_path\\my_file.csv'
   USING
   (
      DELIMITER ','
      LOGDIR 'C:\\my_log'
      Y2BASE 2000
      ENCODING 'internal'
      SKIPROWS 1
      REMOTESOURCE 'ODBC'
      ESCAPECHAR '\'
      FORMAT 'text'
   )

这篇关于将数据从csv文件导入IBM netezza sql数据库时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆