Page 1 of 1

Postgresql - import CSV data

Posted: Thu 11 Jun 2020 15:42
by chkaufmann
Hi,

with a TUniQuery I can run a command like:

Code: Select all

copy mytable(col1,col2) from 'testdata.csv' delimiter ',' csv
This works fine when the csv file is placed on the server.
Now I have my file on the client computer and it doesn't work. I can do it with the command line tool psql.exe (\copy command) but my question is, if there is a way to run it from inside my Delphi application.

Christian

Re: Postgresql - import CSV data

Posted: Wed 17 Jun 2020 10:34
by oleg0k
Hello,
The Copy command is executed by PostgreSQL server, not UniDAC components. The server uses a local file system ( https://www.postgresql.org/docs/current/sql-copy.html ).
To load data from a file to a table on the client side, you can use the TUniLoader component in UniDAC or psql.exe.

wbr, Oleg
Devart Team