gzip - How to delimit a compressed fixed length file with uncompressing it -
i'm dealing compressed (gzip) fixed length flat files need turn delimited flat files can feed gpload. told possible delimit file without needing decompress it, , feed directly gpload since can handle compressed files.
does know of way delimit file while in .gz format?
there no way delimit gzip-compressed data without decompressing it. don't need delimit it, can load fixed-width data type, decompressed on fly gpfdist. refer "importing , exporting fixed width data" chapter in admin guide here: http://gpdb.docs.pivotal.io/4330/admin_guide/load.html
here's example:
[gpadmin@localhost ~]$ gunzip -c testfile.txt.gz bob jones 27 steve balmer 50 [gpadmin@localhost ~]$ gpfdist -d ~ -p 8080 & [1] 41525 serving http on port 8080, directory /home/gpadmin [gpadmin@localhost ~]$ psql -c " > create readable external table students ( > name varchar(20), > surname varchar(30), > age int) > location ('gpfdist://127.0.0.1:8080/testfile.txt.gz') > format 'custom' (formatter=fixedwidth_in, > name='20', surname='30', age='4'); > " create external table [gpadmin@localhost ~]$ psql -c "select * students;" name | surname | age -------+---------+----- bob | jones | 27 steve | balmer | 50 (2 rows)
Comments
Post a Comment