Re: Fetching query result problem
От | Daniele Varrazzo |
---|---|
Тема | Re: Fetching query result problem |
Дата | |
Msg-id | CA+mi_8aUEV7yVXr05V9iTtAEYuWzHtnZ7RScgQwB_fn6cNUc3w@mail.gmail.com обсуждение исходный текст |
Ответ на | Fetching query result problem (Jacek Kałucki <laborm@rz.onet.pl>) |
Ответы |
Re: Fetching query result problem
|
Список | psycopg |
2012/1/16 Jacek Kałucki <laborm@rz.onet.pl>: > Hi. > > I have a problem with some query. > When I issue it from within postgresql console, it returns correct rows > count as a result, > but when executed within psycopg2 cursor.execute() row count differs. > In first situation I get 5 rows versus 3 at second time. [...] > Could you give me any suggestions how to figure the reason out? There's no reason why this should happen. - It could be a different in transactions usage: a query run in psql is not wrapped in a transaction whereas psycopg has an implicit "begin" before, and data is not committed until you explicitly commit: make sure the data you are expecting is visible. Try running the query in psycopg with autocommit = true to get the same data visibility you have in psql. - could you have python data types converted to something unexpected? Enable server logging to see the query the backend receives, and use diff to compare the logs and spot differences between what received from psql and what from psycopg. - check the connection string: you may be talking to the wrong database. -- Daniele
В списке psycopg по дате отправления: