| От | Greg Smith |
|---|---|
| Тема | Re: wriring a file to a database |
| Дата | |
| Msg-id | Pine.GSO.4.64.0712081442010.2045@westnet.com обсуждение |
| Ответ на | wriring a file to a database (Roger Mason <rmason@esd.mun.ca>) |
| Список | pgsql-general |
On Sat, 8 Dec 2007, Roger Mason wrote:
> I want to write a file into a database from python using psycopg.
You don't use lo_import directly for that. There is an example program
included with psycopg that shows the right syntax to insert a file. For
psycopg1, see bytea.py ; for psycopg2 look at binary.py
> curs.execute("INSERT INTO diamonds VALUES (%s,
> \lo_import(%s))",(iname, image))
> psycopg2.ProgrammingError: syntax error at or near "\" at character 50
Just so you know, the commands starting with \ like \lo_import are
specific to the psql client. None of those will work if you use another
tool to connect.
--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера