I want to create extern table in Greenplum like this:
CREATE READABLE EXTERNAL TABLE "table"
("id" INTEGER, "name" TEXT)
LOCATION ('<file location>')
FORMAT 'TEXT' (DELIMITER '1' NEWLINE 'CRLF' NULL 'NULL' )
The problem is that my data already has symbols such as 'CRLF'
, 'CR'
and 'LF'
, so I want to save them and I want the NEWLINE
delimiter as some special symbol such as '0x01'
or something that arent being in my data.
I know that GP allows to use a CUSTOM formatter, but in such case I must create an implementation of this formatter in C language. It seems quite difficult, because all I need is a way to use some other delimiters except 'CR'
, 'LF'
and 'CRLF'
.
How can I do that?
I tried to search some ready custom formatter:
gp formatter fo fixed width cols
gp text formatter (float and char)
json formatter
but I don’t understand how can I use them for my problem as they do nothing with delimiters and use several data types just for examples.
Also GP source implementation is fully connected with other modules and quite difficult to understand (I tried to find why the allow only 'CR'
'LF'
and 'CRLF'
newlines).
Also not an option to change the source data.