GreenPlum创建外部表示例
Example 1—Single Greenplum file server (gpfdist) instance on multiple NIC machine Creates a readable external table named ext_expenses using the gpfdist protocol. The files are formatted with a pipe ( | ) as the column delimiter. CREATE E
Example 1—Single Greenplum file server (gpfdist) instance on multiple NIC machine Creates a readable external table named ext_expenses using the gpfdist protocol. The files are formatted with a pipe ( | ) as the column delimiter.CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gpfdist://etlhost-1:8081/*', 'gpfdist://etlhost-2:8081/*' ) FORMAT 'TEXT' (DELIMITER '|');
Example 2—Multiple Greenplum file server (gpfdist) instances Creates a readable external table named ext_expenses using the gpfdist protocol from all files with the txt extension. The files are formatted with a pipe ( | ) as the column delimiter and an empty space as null.
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gpfdist://etlhost-1:8081/*.txt', 'gpfdist://etlhost-2:8082/*.txt' ) FORMAT 'TEXT' ( DELIMITER '|' NULL ' ') ;
Example 3—Multiple secure Greenplum file server (gpfdists) instances Creates a readable external table named ext_expenses using the gpfdists protocol from all files with the txt extension. The files are formatted with a pipe ( | ) as the column delimiter and an empty space as null.
First, run gpfdist with the --ssl option. Then, execute the following command.
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gpfdists://etlhost-1:8081/*.txt', 'gpfdists://etlhost-2:8082/*.txt' ) FORMAT 'TEXT' ( DELIMITER '|' NULL ' ') ;
Example 4—Single Greenplum file server (gpfdist) instance with error logging Creates a readable external table named ext_expenses using the gpfdist protocol from all files with the txt extension. The files are formatted with a pipe ( | ) as the column delimiter and an empty space as null.
The external table is accessed in single row error isolation mode. An error table (err_customer) is specified. Any data formatting errors that are found in the input data will be discarded to err_customer, along with a description of the error. err_customer can later be queried in order to see the nature of errors and reload the rejected data after fixing the issues. If the count of badly formatted data rows on any specific segment is greater than five (specified as the SEGMENT REJECT LIMIT value), the entire external table operation will be aborted and no rows will be processed.
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gpfdist://etlhost-1:8081/*.txt', 'gpfdist://etlhost-2:8082/*.txt' ) FORMAT 'TEXT' ( DELIMITER '|' NULL ' ') LOG ERRORS INTO err_customer SEGMENT REJECT LIMIT 5;
Create the same readable external table definition as above, but with CSV formatted files:
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gpfdist://etlhost-1:8081/*.txt', 'gpfdist://etlhost-2:8082/*.txt' ) FORMAT 'CSV' ( DELIMITER ',' ) LOG ERRORS INTO err_customer SEGMENT REJECT LIMIT 5;
Example 5—TEXT Format on a Hadoop Distributed File Server (HDFS) Creates a readable external table named ext_expenses using the gphdfs protocol. The files are formatted with a pipe ( | ) as the column delimiter.
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'gphdfs://hdfshost-1:8081/data/filename.txt' ) FORMAT 'TEXT' (DELIMITER '|');
Note: Only one data path is permitted with gphdfs. For examples of reading and writing custom formatted data on a Hadoop Distributed File System.
Example 6—Multiple file protocols in CSV format with header rows Creates a readable external table named ext_expenses using the file protocol.The wildcard specifications are not the same for all the files. The files are formatted in CSV format and have a header row.
CREATE EXTERNAL TABLE ext_expenses ( name text, date date, amount float4, category text, desc1 text ) LOCATION ( 'file://filehost:5432/data/international/*', 'file://filehost:5432/data/regional/*' 'file://filehost:5432/data/supplement/*.csv' ) FORMAT 'CSV' (HEADER);
Example 7—Readable Web External Table with Script Create a readable web external table that executes a script once per segment host:
CREATE EXTERNAL WEB TABLE log_output (linenum int, message text) EXECUTE '/var/load_scripts/get_log_data.sh' ON HOST FORMAT 'TEXT' (DELIMITER '|');
Example 8—Writable External Table that Writes to a File Create a writable external table named sales_out that uses gpfdist to write output data to a file named sales.out. The files are formatted with a pipe (|) as the column delimiter and an empty space as null.
CREATE WRITABLE EXTERNAL TABLE sales_out (LIKE sales) LOCATION ('gpfdist://etl1:8081/sales.out') FORMAT 'TEXT' ( DELIMITER '|' NULL ' ') DISTRIBUTED BY (txn_id);
Example 9—Writable External Web Table with Script Create a writable external web table that pipes output data received by the segments to an executable script named to_adreport_etl.sh:
CREATE WRITABLE EXTERNAL WEB TABLE campaign_out (LIKE campaign) EXECUTE '/var/unload_scripts/to_adreport_etl.sh' FORMAT 'TEXT' (DELIMITER '|');
Use the writable external table defined above to unload selected data:
INSERT INTO campaign_out SELECT * FROM campaign WHERE customer_id=123;
Example 10—Readable and Writable External Tables with XML Transformations Greenplum Database now can read and write XML data to and from external tables with gpfdist. For information on setting up an XML transform, see “Transforming XML Data” on page 178. The following code reads XML data into a table.
CREATE READABLE EXTERNAL TABLE prices_readable (LIKE prices) LOCATION ('gpfdist://127.0.0.1:8080/data/prices.xml#transform=prices_input') FORMAT 'text' (delimiter '|') LOG ERRORS INTO prices_errortable SEGMENT REJECT LIMIT 10;
The following code creates a writable external table that transforms the data in the Greenplum Database to XML.
CREATE WRITABLE EXTERNAL TABLE prices_readable (LIKE prices) LOCATION ('gpfdist://127.0.0.1:8080/data/prices.xml#transform=prices_input') FORMAT 'text' (delimiter '|');

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

Excel是否继续抛出此工作簿包含指向一个或多个外部源的链接,这些外部源在打开工作簿时可能会显示不安全警告消息?许多用户报告说,无论何时打开Excel文件都会收到此警告。虽然该警告指示工作簿中存在潜在的恶意链接,但即使您已包含受信任的外部来源,也可能会触发该警告此工作簿包含指向一个或多个可能不安全的外部源的链接如果打开Excel文件时出现警告提示“此工作簿包含指向一个或多个可能不安全的外部源的链接”,您可以尝试以下解决方案来解决该问题:检查工作簿中的外部链接并删除不受信任的链接。使用编辑链接功能

标题:真我手机新手指南:如何在真我手机上创建文件夹?在当今社会,手机已经成为人们生活中必不可少的工具。而真我手机作为一款备受欢迎的智能手机品牌,其简洁、实用的操作系统备受用户喜爱。在使用真我手机的过程中,很多人可能会遇到需要整理手机中的文件和应用的情况,而创建文件夹就是一种有效的方式。本文将介绍如何在真我手机上创建文件夹,帮助用户更好地管理自己的手机内容。第

本文将引起您的兴趣,如果您有意在Windows上使用GIMP进行像素艺术创作。GIMP是一款著名的图形编辑软件,不仅免费开源,还能帮助用户轻松创建出美丽的图像和设计。除了适用于初学者和专业设计师外,GIMP也可以用于制作像素艺术,这种数字艺术形式是利用像素作为唯一构建块来进行绘制和创作的。如何在GIMP中创建像素艺术以下是在WindowsPC上使用GIMP创建像素图片的主要步骤:下载并安装GIMP,然后启动应用程序。创建一个新的形象。调整宽度和高度的大小。选择铅笔工具。将笔刷类型设置为像素。设置

很多朋友表示想知道在格力+软件里该怎么去创建家庭,下面为大家带来了操作方法,想要了解的朋友和我一起来看看吧。首先,打开手机上的格力+软件,并登录。接着,在页面底部的选项栏中,点击最右边的“我的”选项,即可进入个人账户页面。2.来到我的页面后,在“家庭”下方的选项里有一个“创建家庭”,找到后在它的上面点击进入。3.接下来跳转到创建家庭的页面里,根据提示在输入框里输入要设置的家庭名称,输入好后在右上角点击“保存”按钮。4.最后在页面下方会弹出一个“保存成功”的提示,代表家庭已经成功创建好了。

如何使用Highcharts创建甘特图表,需要具体代码示例引言:甘特图是一种常用于展示项目进度和时间管理的图表形式,能够直观地展示任务的开始时间、结束时间和进度。Highcharts是一款功能强大的JavaScript图表库,提供了丰富的图表类型和灵活的配置选项。本文将介绍如何使用Highcharts创建甘特图表,并给出具体的代码示例。一、Highchart

Oracle中的DECODE函数是一种条件表达式,常用于在查询语句中根据不同的条件返回不同的结果。本文将详细介绍DECODE函数的语法、用法和示例代码。一、DECODE函数语法DECODE(expr,search1,result1[,search2,result2,...,default])expr:要进行比较的表达式或字段。search1,

Go语言的缩进规范及示例Go语言是一种由Google开发的编程语言,它以简洁、清晰的语法着称,其中缩进规范在代码的可读性和美观性方面起着至关重要的作用。本文将介绍Go语言的缩进规范,并通过具体的代码示例进行详细说明。缩进规范在Go语言中,缩进使用制表符(tab)而非空格。每级缩进为一个制表符,通常设置为4个空格的宽度。这样的规范统一了代码风格,使得团队合作编

Django项目开启之旅:从命令行开始,创建你的第一个Django项目Django是一个强大而又灵活的Web应用框架,它以Python为基础,提供了许多开发Web应用所需的工具和功能。本文将带领你从命令行开始,创建你的第一个Django项目。在开始之前,请确保你已经安装了Python和Django。步骤一:创建项目目录首先,打开命令行窗口,并创建一个新的目录
