Is using 'COPY <table> FROM <file>' without superuser privileges possible?
Jorge Godoy <[email protected]> Mon, 25 Aug 2003 13:07:50 -0300
| Newsgroups | gmane.comp.python.db.pypgsql.user |
|---|---|
| Message-ID | <[email protected]> |
Hi.
I have to feed a database with several hundred entries and I am
importing all those with PostgreSQL's 'COPY <table> FROM <file>'
command. It works great when I'm using my superuser but it fails for
any other user with a message specifying that I should either:
* use my superuser
* make these users superuser
* or use 'stdin' (this is the recommendation on the error message)
as source for my input.
Since I can't make other superusers (there are several other databases
there that should be protected from common employees) I was trying to
use stdin as data source.
Anybody has tried it? I don't know how to concatenate the thousands of
lines from the output of a 'file.readlines()' (or something like that)
to my cursor.execute() command. Using something like
"cursor.execute(query_sql, file.readlines())" didn't work and gave me
an error message saying 'not all arguments converted' (query_sql is
the copy from command).
TIA,
--
Godoy. <[email protected]>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf