简体   繁体   中英

How do i import .csv file from a remote server to a postgreSQL database?

The original code is a simple SQL import :

LOAD DATA LOCAL INFILE 'D:/FTP/foo/foo.csv'

INTO TABLE error_logs

FIELDS TERMINATED BY ','
ENCLOSED BY '"' 
ESCAPED BY ''
LINES STARTING BY ''
TERMINATED BY '\n' 

IGNORE 1 LINES

(Server,Client,Error,Time);

I need to migrate a web portal (from SQL to Postgres[I know there are tools for that, but its not the question]) and the issue is i am no more working on local.

I didn't see anybody ask the question in this way : import .csv from a remote server to a postgres db.

I think i have to use COPY but i dont get the right syntax...

Thanks for your attention.

the copy command is an option to do this.

I had to do this once time.

How to import CSV file data into a PostgreSQL table?

Copying PostgreSQL database to another server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM