On Wed, 2012-02-15 at 19:01 +0100, Guillaume Lelarge wrote:
> On Wed, 2012-02-15 at 10:36 -0700, John Abraham wrote:
> > These are two things that bug me every single day:
> >
> > 1) "\copy" equivalent. psql has \copy to copy from a local file. Using the JDBC driver I also often copy data
intothe database using the equivalent COPY .. FROM STDIN… With psycopg2 I also use COPY FROM STDIN to have the local
pythonapp feed the file to the postgres COPY command. In PGAdmin, however, to bulk load data into postgres we need to
copythe CSV file to the computer where the database resides and fiddle with permissions until the database can read the
fileusing COPY. This should be easy to implement, it wasn't hard for me to do it with both psycopg2 and with the JDBC
driver,and psql has had it for years. The application (PGAdmin) needs to open the file and then feed the stream to the
databaseCOPY command as STDIN.
> >
>
> I agree that this doesn't appear difficult to implement. Some kind of an
> import data menu in the table's contextual menu.
>
I worked on this one all this afternoon. I now have an import window
which is capable of doing everything that COPY... FROM... does.
You can see some screenshots at:
http://developer.pgadmin.org/~guillaume/importtool/
And if you want to test it, code is available on:
https://github.com/gleu/pgadmin3/tree/importcsv
I would appreciate any comments on it before I apply it.
--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com