postgresql-copy Questions

13

Solved

I have a database schema named: nyummy and a table named cimory: create table nyummy.cimory ( id numeric(10,0) not null, name character varying(60) not null, city character varying(50) not null...
Coopersmith asked 10/10, 2012 at 8:51

7

Solved

I want to copy a CSV file to a Postgres table. There are about 100 columns in this table, so I do not want to rewrite them if I don't have to. I am using the \copy table from 'table.csv' delimiter...
Libertylibia asked 15/7, 2013 at 19:50

21

Solved

What is the easiest way to save PL/pgSQL output from a PostgreSQL database to a CSV file? I'm using PostgreSQL 8.4 with pgAdmin III and PSQL plugin where I run queries from.
Shift asked 4/10, 2009 at 22:58

4

I'm trying to import a .txt file into PostgreSQL. The txt file has 6 columns: Laboratory_Name Laboratory_ID Facility ZIP_Code City State And 213 rows. I'm trying to use \copy to put the conten...
Hushaby asked 5/11, 2014 at 0:33

6

I am using pgAdmin version 4.3 and i want to export one table data to CSV file. I used this query COPY (select * from product_template) TO 'D:\Product_template_Output.csv' DELIMITER ',' CSV HEADER...
Tomboy asked 14/12, 2018 at 10:5

21

How can I write a stored procedure that imports data from a CSV file and populates the table?
Achromatin asked 7/6, 2010 at 6:19

14

Solved

I'm trying to export a PostgreSQL table with headings to a CSV file via command line, however I get it to export to CSV file, but without headings. My code looks as follows: COPY products_273 to...
Ayers asked 13/7, 2009 at 15:19

8

I run this command: COPY XXX FROM 'D:/XXX.csv' WITH (FORMAT CSV, HEADER TRUE, NULL 'NULL') In Windows 7, it successfully imports CSV files of less than 1GB. If the file is more then 1GB big, I ...
Maher asked 28/11, 2018 at 15:37

4

Table columns: col1, col2, col3, fname, lname CSV file contains values like: col1,col2,col3 val1,val2,val3 val1,val2,val3 I want to add data from csv along with additional data i.e. col1,col2...
Luo asked 30/12, 2015 at 13:2

3

Solved

I have problem when run 1 project NodeJs with PostgreSQL database. I have error when trying to insert data in pgAdmin using the COPY command. COPY beer (name, tags, alcohol, brewery, id, brewery_i...
Sulfapyrazine asked 28/8, 2015 at 12:43

2

Solved

I have a text file containing the row numbers of the rows that should be deleted in my table like this: 3 32 40 55 [...] How can I get a PostgreSQL compatible SQL statement which deletes each of...
Spermatophyte asked 5/10, 2011 at 9:11

3

I have a big compressed csv file (25gb) and I want to import it into PostgreSQL 9.5 version. Is there any fast way to import zip or qzip file into postgres without extracting the file?
Fusion asked 19/1, 2017 at 10:0

8

Solved

I am on windows 7 64 bit. I have a csv file 'data.csv'. I want to import data to a postgresql table 'temp_unicommerce_status' via a python script. My Script is: import psycopg2 conn = psycopg2.co...
Quan asked 5/5, 2015 at 10:10

3

I have some csv data in excel, and I'm importing it into postgresql. I'm opening the excel csv file with a notepad editor (have tried notepad, wordpad and notepad++) and am then copying/pasting int...
Catarrhine asked 19/6, 2015 at 21:16

2

Solved

I am trying to import a txt/csv file into my postgres database from php using "\copy" command. I cannot use COPY instead of \copy as I need it to execute as a psql client. My code is: $query = '\\...
Elinoreeliot asked 15/1, 2012 at 10:40

2

Solved

I had a question surrounding the COPY command in PostgreSQL. I have a CSV file that I only want to copy some of the columns values into my PostgreSQL table. Is it possible to do this? I am familia...
Narial asked 29/3, 2013 at 16:41

2

I want to use the \copy command to make csv file with relative path. I used a query to make from test table to csv file named test.csv \copy (SELECT * FROM test) to './test.csv' with csv But in ...
Ripley asked 17/12, 2016 at 6:36

2

Unable to use copy command with jdbc Postgres. Whats wrong with the below code snippet sample. public boolean loadReportToDB(String date) { // TODO Auto-generated method stub Connection connecti...
Cytochemistry asked 28/10, 2017 at 10:46

3

Solved

Today I spent my day improving the performance of my Python script which pushes data into my Postgres database. I was previously inserting records as such: query = "INSERT INTO my_table (a,b,c ......
Evenson asked 12/10, 2017 at 17:14

2

Solved

Given a CSV with several dozen or more columns, how can a 'schema' be created that can be used in a CREATE TABLE SQL expression in PostgreSQL for use with the COPY tool? I see plenty of examples f...
Verdin asked 6/2, 2016 at 16:33

5

I want to load the data from a flat file with delimiter "~,~" into a PostgreSQL table. I have tried it as below but looks like there is a restriction for the delimiter. If COPY statement doesn't al...
Algophobia asked 3/8, 2011 at 17:0

6

Solved

I need to export the resulting data from a query in PostgreSQL to Excel/CSV. I use PostgreSQL 8.2.11. SQL error: ERROR: relative path not allowed for COPY to file In statement: COPY (select dist...
Auscultate asked 14/11, 2011 at 9:7

1

Solved

I have a query written in a file located at /path/to/query. How can I save the output result to a csv file, without using COPY in the query? I tried the following command, but the output file's fie...
Ossuary asked 26/5, 2015 at 4:57

1

Solved

I'm trying to execute the Postgres COPY command. COPY warehouse_terminal.test_table FROM 'C:\file.csv' DELIMITERS E'\t' CSV HEADER QUOTE E'\"' ESCAPE E'\\' NULL AS ''; The problem is, the db wh...
Watters asked 24/9, 2014 at 2:6

1

Solved

I am trying to write a function to load csv data into a table. I want the input argument to be the path to the file. CREATE OR REPLACE FUNCTION public.loaddata(filepathname varchar) RETURNS void A...
Khedive asked 15/4, 2013 at 15:51

© 2022 - 2024 — McMap. All rights reserved.