Loading zipped CSV(filename.csv.gz) file into PostgreSQL table

前端 未结 2 1712
醉话见心
醉话见心 2021-01-19 03:45

How to load larger amount of csv.gz file into Postgresql without unzipping to csv file ,since I tried pipeline command (mkfifo pipelinename) but it doesn\'t work for me. Is

相关标签:
2条回答
  • 2021-01-19 04:20

    Just to share my simple examples using zcat instead of gzip. Simply less typing. I am using zcat to expand the gzipped file.

    \copy tmptable from program 'zcat O1variant.tab.gz' with (format csv, delimiter E'\t', header TRUE)
    
    0 讨论(0)
  • 2021-01-19 04:26

    Note that this should also work from inside psql:

    \copy TABLE_NAME FROM PROGRAM 'gzip -dc FILENAME.csv.gz' DELIMITER ',' CSV HEADER NULL ''

    0 讨论(0)
提交回复
热议问题