Federico Di Gregorio | 1 Jan 2007 22:46
Favicon
Gravatar

Re: sqlstate code

Il giorno gio, 28/12/2006 alle 17.38 +0100, Oswaldo Hernández ha
scritto:
> 
> How i can get the sqlstate code when an error is raised? 

Use the .pgcode attribute of the exception.

federico

--

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                fog@...
INIT.D Developer                                           fog@...
               Io la coscienza l'ho cagata da piccolo. -- Natale Titotto
_______________________________________________
Psycopg mailing list
Psycopg@...
http://lists.initd.org/mailman/listinfo/psycopg
mobiledreamers | 1 Jan 2007 23:34
Picon

FATAL: sorry, too many clients already

getting the errror
psycopg2.OperationalError at /login
FATAL: sorry, too many clients already
Python     build/bdist.linux-i686/egg/DBUtils/SteadyDB.py in
__init__, line 113

anyone see this

i have DBUtils installed
am using flup
and my postgresql.conf file is this
max_connections = 1024
shared_buffers = 108000

there  are about 103 postgres processes running
of which 99 are idle

any pointers are appreciated
_______________________________________________
Psycopg mailing list
Psycopg@...
http://lists.initd.org/mailman/listinfo/psycopg
johnf | 2 Jan 2007 00:44

Lost Updates

Hi,
In general how does psycopg2 handle the "lost updates" issue?  If its a long 
answer could someone point me to a web link covering how psycopg2 deals 
with "lost updates".

Thanks

--

-- 
John Fabiani
Karsten Hilbert | 2 Jan 2007 11:23
Picon

Re: Lost Updates

On Mon, Jan 01, 2007 at 03:44:57PM -0800, johnf wrote:

> In general how does psycopg2 handle the "lost updates" issue?  If its a long 
> answer could someone point me to a web link covering how psycopg2 deals 
> with "lost updates".

PostgreSQL will abort one transaction. This will (should)
cause an exception being raised at the Python level.

You need to catch the exception to handle it. The .pgcode
attribute of the exception may help.

Karsten
--

-- 
GPG key ID E4071346  <at>  wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
Oswaldo Hernández | 2 Jan 2007 13:17
Picon

Re: sqlstate code

Federico Di Gregorio escribió:
> Il giorno gio, 28/12/2006 alle 17.38 +0100, Oswaldo Hernández ha
> scritto:
>> How i can get the sqlstate code when an error is raised? 
> 
> Use the .pgcode attribute of the exception.
> 

Perfect :)

Thanks Federico.

--

-- 
*****************************************
Oswaldo Hernández
oswaldo ( <at> ) soft-com (.) es
*****************************************
_______________________________________________
Psycopg mailing list
Psycopg <at> lists.initd.org
http://lists.initd.org/mailman/listinfo/psycopg
Karsten Hilbert | 2 Jan 2007 16:02
Picon

Re: sqlstate code

On Mon, Jan 01, 2007 at 10:46:47PM +0100, Federico Di Gregorio wrote:

> > How i can get the sqlstate code when an error is raised? 
> 
> Use the .pgcode attribute of the exception.
It should be noted that this appears to only exist for
ProgrammingError exceptions.

However, the docs suggest that other sorts of things can set
SQLSTATE at the PostgreSQL level (for example class 08 =
Connection Exception).

Is it necessary to set .pgcode on exceptions other than
ProgrammingError ?

Thanks,
Karsten
--

-- 
GPG key ID E4071346  <at>  wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
Federico Di Gregorio | 2 Jan 2007 16:10
Favicon
Gravatar

Re: sqlstate code

Il giorno mar, 02/01/2007 alle 16.02 +0100, Karsten Hilbert ha scritto:
> It should be noted that this appears to only exist for
> ProgrammingError exceptions.
> 
> However, the docs suggest that other sorts of things can set
> SQLSTATE at the PostgreSQL level (for example class 08 =
> Connection Exception).

> Is it necessary to set .pgcode on exceptions other than
> ProgrammingError ? 

Probably it would be a nice idea but it is not one of my priorities. It
should also be pretty simple, just going through the code and add the
necessary atributes where necessary.

Maybe open a wishlist bug.

federico

--

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                fog@...
INIT.D Developer                                           fog@...
                   Datemi uno spigolo. Che lo arrotondo tutto. -- <dani>
_______________________________________________
Psycopg mailing list
Psycopg@...
http://lists.initd.org/mailman/listinfo/psycopg
psycopg | 2 Jan 2007 17:40
Favicon
Gravatar

Re: [psycopg] #137: more careful control when stringifying mx.DateTime and/or datetime instances

#137: more careful control when stringifying mx.DateTime and/or datetime
instances
----------------------+-----------------------------------------------------
 Reporter:  ncq       |        Owner:  fog          
     Type:  defect    |       Status:  new          
 Priority:  normal    |    Milestone:  PSYCOPG 2.0.6
Component:  psycopg2  |      Version:  2.0.5        
 Severity:  normal    |   Resolution:               
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by ncq):

 Some things to be aware of:

  * datetime.datetime instances do not support .Format() as mx.!DateTime
 instances do
  * but mx.!DateTime instances also support strftime() just as
 datetime.datetime does
  * .strftime() does not accept u'' formatters as of Python 2.4 !
  * unfortunately, .isoformat() does not solve the problem:
    * yes, it does return an ISO compatible string
    * but, no, this string is still locale-aware (and thus produces ",")
    * and !PostgreSQL will not accept that

 Something like this does the trick at the Python level:

  * timestamp_instance.isoformat().replace(",", ".")

--

-- 
Ticket URL: <http://initd.org/tracker/psycopg/ticket/137#comment:2>
psycopg <http://initd.org/>
psycopg
psycopg | 2 Jan 2007 17:54
Favicon
Gravatar

[psycopg] #152: .pgcode attribute on more exception types

#152: .pgcode attribute on more exception types
-------------------------+--------------------------------------------------
 Reporter:  ncq          |       Owner:  fog        
     Type:  enhancement  |      Status:  new        
 Priority:  low          |   Milestone:  PSYCOPG 2.1
Component:  psycopg2     |     Version:  2.0.5      
 Severity:  wishlist     |    Keywords:             
-------------------------+--------------------------------------------------
 Currently, as of 2.0.5, .pgcode (SQLSTATE) is only available on
 !ProgrammingError exceptions. The
 [http://www.postgresql.org/docs/8.2/static/errcodes-appendix.html SQLSTATE
 docs] suggest that there are codes for other conditions as well. It'd be
 nice if the .pgcode attribute was set on exception instances other than
 !ProgrammingError, too. I would even argue for setting it on ''all'' DB-
 API exceptions using a value of None where no actual SQLSTATE is
 applicable.

 Thanks,
 Karsten

--

-- 
Ticket URL: <http://initd.org/tracker/psycopg/ticket/152>
psycopg <http://initd.org/>
psycopg
Karsten Hilbert | 2 Jan 2007 17:55
Picon

Re: sqlstate code

On Tue, Jan 02, 2007 at 04:10:36PM +0100, Federico Di Gregorio wrote:

> > Is it necessary to set .pgcode on exceptions other than
> > ProgrammingError ? 
> 
> Maybe open a wishlist bug.

Done, #152.

Karsten
--

-- 
GPG key ID E4071346  <at>  wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

Gmane