Data import/export of Netezza using external table
Introduction
External table is a special table in Netezza system, which could be used to import/export data between flat files and Netezza directly.
Import data from external file to Netezza
Grammar:
CREATE EXTERNAL TABLE EXTERNAL_TABLE_TEST
(
id int,
name varchar(50)
)
USING
(
DATAOBJECT('/mnt/external_files/Test.txt')
--other settings
);
In this scenario, external table is kind of like a pointer. It could be used by other SQL statements, like: CREATE <TABLE_NAME> AS SELECT * FROM EXTERNAL_TABLE_TEST.
Since it is not the real table, once the external table is created, it is not allowed to alter the data of the external table.
For the external file location, it should be an address of the Netezza host linux box.? ODBC driver?
When the requirement is only to check the data in the external file, there is no need to store a external table, then a transient external table(TET) could be used.
Here is an example of TET table:
SELECT * FROM EXTERNAL '/mnt/external_files/Test.txt'
(
id int,
name varchar(50)
)
USING
(
--settings
);
Basically, when using EXTERNAL '...' (...) USING (...), the system will create a TET table when executing the query. The TET phrases could also be used as a part of other SQL statements, like:
INSERT INTO <TABLE_NAME> SELECT * FROM EXTERNAL '...' (...) USING (...)
CREATE <TABLE_NAME> AS SELECT * FROM EXTERNAL '...' (...) USING (...)
Export data from Netezza to external file
Grammar:
CREATE EXTERNAL TABLE [EXTERNAL_TABLE_TEST] '/mnt/external_files/nzoutput.txt'
USING
(
DELIM ','
--other settings
)
AS
SELECT * FROM OUTPUT_TABLE
;
The grammar is similar, and external table is also like a pointer to the file. Each time the query executed, the external file will be refreshed. If the EXTERNAL_TABLE_TEST name is , then a system TET will be used.
So it is not allowed to alter the external table?
The external table could also be used by other SQL statements?
external file could be modified?
File format setting
Basically, there are two kinds of format for a file, delimited(default) and fixed. Here is an example of external file with FIXED FORMAT.
DROP TABLE Test_Fixed;
CREATE EXTERNAL TABLE Test_Fixed
(
ID BIGINT,
NAME VARCHAR(10),
)
USING
(
DATAOBJECT('/mnt/test.txt')
FORMAT 'FIXED'
LOGDIR '/tmp/test.txt'
LAYOUT
(
BYTES 19,
BYTES 10
)
);
SELECT * FROM Test_Fixed;
There are many other settings, here is the most frequently ones:
ENCODING 'UTF8'-- default is INTERNAL, which is for ansi file
SKIPROWS 1 -- Skip the first row, this is usually setted when the file has a header row.
FORMAT 'FIXED' --default is text, which means the delimited format
DELIMITER ',' --default is pipe, this is limited to only one character
ESCAPECHAR '/' --this is used when the file is delimited and the delimiter is included as the data
QUOTEDVALUE double --default is no quotedvalue
LOGDIR '/mnt/hqaasan01/development_adhoc/' --specify the log dir, the log is very helpful when troubleshooting
Note: Since Netezza host is a Linux box, the import/export file format could only be linux format(use LF as row delimiter).
External articles
http://www.cnblogs.com/s021368/p/3582914.html
Data import/export of Netezza using external table的更多相关文章
- Netezza External Tables --How to use local files in external table
FROM: http://tennysusantobi.blogspot.com/2012/08/netezza-external-tables.html Netezza External Table ...
- 1.3 Quick Start中 Step 7: Use Kafka Connect to import/export data官网剖析(博主推荐)
不多说,直接上干货! 一切来源于官网 http://kafka.apache.org/documentation/ Step 7: Use Kafka Connect to import/export ...
- [Hive - LanguageManual] Import/Export
LanguageManual ImportExport Skip to end of metadata Added by Carl Steinbach, last edited by Le ...
- Importing/Indexing database (MySQL or SQL Server) in Solr using Data Import Handler--转载
原文地址:https://gist.github.com/maxivak/3e3ee1fca32f3949f052 Install Solr download and install Solr fro ...
- sqoop import/export使用经验
一.先创建一个小表(test_01)进行测试(主节点IP:169.254.109.130/oracle服务器IP:169.254.109.100) 1.测试连接oracle; sqoop list-t ...
- SQL Azure (18) 使用External Table实现垮库查询
<Windows Azure Platform 系列文章目录> 问题 1.我们在进行SQL Server开发的时候,经常会使用垮库查询.但是在默认情况下,使用Azure SQL Datab ...
- 前端 高级 (二十五)vue2.0项目实战一 配置简要说明、代码简要说明、Import/Export、轮播和列表例子
一.启动服务自动打开浏览器运行 二.配置简要说明 1.node_modules 安装好的依赖文件,中间件等,所在位置 2.package.jason 配置当前项目要安装的中间件和依赖文件 { &quo ...
- es6 import export 引入导出变量方式
var testdata='sdfkshdf'; //export testdata;//err export {testdata as ms}; export var firstName = 'Mi ...
- 探讨ES6的import export default 和CommonJS的require module.exports
今天来扒一扒在node和ES6中的module,主要是为了区分node和ES6中的不同意义,避免概念上的混淆,同时也分享一下,自己在这个坑里获得的心得. 在ES6之前 模块的概念是在ES6发布之前就出 ...
随机推荐
- 德国GFZ
关于GFZ的介绍,图片中有,这里不赘述. 在下面的图片中介绍的,除了能够提供免费的数据支持外,就属左边的应用框架. 1.目前开源框架里,空间数据库多是postgis,根据数据量和组织方式,可以选择mo ...
- 前端设计师也有必要学习seo,推荐一个seo博客
做前端设计师有一段时间了,现在越来越觉得作为一个前端设计师,必须要懂一些seo的知识. 因为公司的seo们,总是在网站做好以后,提出各种各样的网站修改的需求. 如果前端设计师,能够了解一些基本的seo ...
- OpenGL ES(一.概念)
OpenGL ES是以手持和嵌入式设备为目标的高级3D图形应用程序编程接口,主要的支持平台是iOS,Android,Linux和Windows 1.顶点着色器 他可以用于通过矩阵变换位置,计算照明公式 ...
- Linux网络基本配置
一.Linux网络配置文件 1. /etc/sysconfig/network-scripts/ifcfg-eth0 文件 在Red Hat系统中,系统网络设备的配置文件保存在/etc/syscon ...
- 洛谷P2409 Y的积木
P2409 Y的积木 77通过 491提交 题目提供者zhouyonglong 标签云端评测 难度普及+/提高 提交 讨论 题解 最新讨论 这组数据几乎可以卡掉所有程- 第一个题解有点问题 求教大 ...
- Oracle和SQLServer解锁杀进程
ORACLE:在平时工作中经常会遇到数据库死锁的情况,以前使用oracle时候(那时候还不懂),出现这种情况时前辈给了我一段命令:SELECT dob.OBJECT_NAME Table_Name,l ...
- [react native] react-native-tab-navigator在子Component中隐藏
因为文档只列出了TabBarIOS, 不支持Android,所以github上找到这个组件. 先说下我的页面构造: 入口文件 —> 注册组件(包含Navigator, 跳转到欢迎页)—> ...
- Python应用科学计算和图表绘制
今天更新了两个python模块,一个是用于科学计算的numpy模块,另一个是用于绘图的matplotlib模块 python安装模块还是很方便的,安装了pip之后直接使用"pip insta ...
- 树型hierarchyid类型
--查询所有下级 DECLARE @BOSS hierarchyid --查询所有上级 DECLARE @Employee hierarchyid
- C#遍历集合与移除元素的方法
如果用foreach,会造成被遍历的集合更改后带来异常问题. 此时,用for循环可有效的解决这个问题. for(int i=0;i<List.Count;i++) { if(条件是真) { Li ...