From lists at jwp.name Sat Apr 4 02:47:53 2009 From: lists at jwp.name (James Pye) Date: Fri, 3 Apr 2009 17:47:53 -0700 Subject: [DB-SIG] py-postgresql-0.8 for Python 3 Released: Was pg_proboscis Message-ID: I'm pleased to announce the release of py-postgresql 0.8. This release marks months of work porting the 2.x code to Python 3 and making numerous improvements. py-postgresql is a port of pg_proboscis-1.0 and other projects under the "pg/python project umbrella". This release simplifies the project structure by combining the smaller projects into one easy-to-manage package. http://python.projects.postgresql.org Documentation: http://python.projects.postgresql.org/docs/0.8 Source: http://python.projects.postgresql.org/files/py- postgresql-0.8.0.tar.gz Win32 Installer: http://python.projects.postgresql.org/files/py-postgresql-0.8.0.win32-py30.exe Features: * BSD/MIT/PSF Licensed. * Documentation. =) * Pure-Python + C optimizations. No need for libpq. * Prepared Statement driven interface/native APIs. (DB-API 2.0 is here too ;) (PG-API, [Was: "pg_greentrunk"]) * Scrollable cursors with configurable direction for paging. * COPY support. [iter(db.prepare("COPY table TO STDOUT"))] * Windows support. We love you too. ;) * pg_python quick console. $ pg_python -h localhost -> Gives a Python prompt with a connection bound to `db`. * Support for most PostgreSQL types. (datetime.*, numeric->decimal, and more) * Composite Types and Arrays. Fully structured for easy access. * Row-objects returned by cursors support Mapping and Sequence interfaces. (row["colname"], row[0]) * Over 150 tests and counting! Sample PG-API code via pg_python: $ pg_python -h localhost -U postgres -d postgres Backslash Commands: \? Show this help message. \E Edit a file or a temporary script. \e Edit and Execute the file directly in the context. \i Execute a Python script within the interpreter's context. \set Configure environment variables. \set without arguments to show all \x Execute the Python command within this process. Python 3.0.1+ (release30-maint:70204M, Mar 5 2009, 21:28:06) Type "help", "copyright", "credits" or "license" for more information. (ExtendedConsole) >>> ps = db.prepare('select 1') >>> ps() [(1,)] >>> ps.first() 1 >>> c = ps.declare() >>> c.read() [(1,)] >>> c.seek(0) >>> c.read() [(1,)] From lists at jwp.name Sat Apr 4 02:51:40 2009 From: lists at jwp.name (James Pye) Date: Fri, 3 Apr 2009 17:51:40 -0700 Subject: [DB-SIG] py-postgresql-0.8 for Python 3 Released: Was pg_proboscis In-Reply-To: References: Message-ID: On Apr 3, 2009, at 5:47 PM, James Pye wrote: > Win32 Installer: > http://python.projects.postgresql.org/files/py-postgresql-0.8.0.win32-py30.exe sigh, that link should be: http://python.projects.postgresql.org/files/py-postgresql-0.8.0.win32-py3.0.exe From marcoinc at mac.com Sun Apr 5 06:20:26 2009 From: marcoinc at mac.com (Marco A. Gonzalez) Date: Sun, 05 Apr 2009 00:20:26 -0400 Subject: [DB-SIG] Where's datetime? Message-ID: <77168759-340A-440D-847A-BE2181E1F6DC@mac.com> I'm a newcomer to Python and excited about using with a database, but I can't get one to work despite how easy it purports to be. After installing Python 3.0.1, and PostgreSQL 8.3 and py-postgresql v0.8.0, and doing the following from the command line: >>> import postgresql >>> db = postgresql.open("pq://localhost/postgres") I get "ImportError: No module named datetime". Upon further inspection, I see that the protocol directory just doesn't have a datetime file. Did I miss installing something? Can someone tell me what I'm doing wrong? [mbp120computer:Development/Python/py-postgresql-0.8.0] marco% python3.0 Python 3.0.1 (r301:69597, Feb 14 2009, 19:03:52) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import postgresql >>> db = postgresql.open("pq://localhost/postgres") Traceback (most recent call last): File "", line 1, in File "postgresql/__init__.py", line 53, in open from . import driver as pg_driver File "postgresql/driver/__init__.py", line 10, in from .pq3 import Driver File "postgresql/driver/pq3.py", line 35, in from ..protocol import typio as pg_typio File "postgresql/protocol/typio.py", line 56, in from ..python.datetime import UTC, FixedOffset ImportError: No module named datetime >>> [mbp120computer:py-postgresql-0.8.0/postgresql/python] marco% ls __init__.py decorlib.pyc functools.py itertools.pyc __init__.pyc doc.py functools.pyc optimized.c decorlib.py doc.pyc itertools.py socket.py [mbp120computer:py-postgresql-0.8.0/postgresql/python] marco% ------------------------------------------------------ Marco A. Gonzalez, President Amagavi, Inc. Developer of database-driven web sites web: http://www.amagavi.com/ email on iPhone: marcoinc at mac.com email on laptop: marco at amagavi.com cell: 202-222-5137 From lists at jwp.name Sun Apr 5 08:19:38 2009 From: lists at jwp.name (James Pye) Date: Sat, 4 Apr 2009 23:19:38 -0700 Subject: [DB-SIG] Where's datetime? In-Reply-To: <77168759-340A-440D-847A-BE2181E1F6DC@mac.com> References: <77168759-340A-440D-847A-BE2181E1F6DC@mac.com> Message-ID: <60ABF52C-172E-43A0-9351-635391E2FF88@jwp.name> On Apr 4, 2009, at 9:20 PM, Marco A. Gonzalez wrote: > I'm a newcomer to Python and excited about using with a database, > but I can't get one to work despite how easy it purports to be. > > After installing Python 3.0.1, and PostgreSQL 8.3 and py-postgresql > v0.8.0, and doing the following from the command line: > > >>> import postgresql > >>> db = postgresql.open("pq://localhost/postgres") > > I get "ImportError: No module named datetime". Upon further > inspection, I see that the protocol directory just doesn't have a > datetime file. > > Did I miss installing something? Can someone tell me what I'm doing > wrong? Nope, I did something wrong. Fix coming in a bit. Thanks. Missed a git add . sigh. :( From lists at jwp.name Sun Apr 5 08:59:33 2009 From: lists at jwp.name (James Pye) Date: Sat, 4 Apr 2009 23:59:33 -0700 Subject: [DB-SIG] Where's datetime? In-Reply-To: <60ABF52C-172E-43A0-9351-635391E2FF88@jwp.name> References: <77168759-340A-440D-847A-BE2181E1F6DC@mac.com> <60ABF52C-172E-43A0-9351-635391E2FF88@jwp.name> Message-ID: On Apr 4, 2009, at 11:19 PM, James Pye wrote: >> Did I miss installing something? Can someone tell me what I'm >> doing wrong? > > Nope, I did something wrong. Fix coming in a bit. Thanks. Missed a > git add . sigh. :( k, it should be fixed. I didn't bump the version as it was a completely fatal bug to the dist. =\ Thank you very much for sending out a message. I *did* test the release a *lot*, but forget to run tests on the actual extracted tarball. sigh. From marcoinc at mac.com Sun Apr 5 15:00:09 2009 From: marcoinc at mac.com (Marco A. Gonzalez) Date: Sun, 05 Apr 2009 09:00:09 -0400 Subject: [DB-SIG] Where's datetime? In-Reply-To: References: Message-ID: <5298EE17-D03D-4DDE-A1D8-FA044E27D0ED@mac.com> Thank YOU very much. :-) It worked! > On Apr 4, 2009, at 11:19 PM, James Pye wrote: >>> Did I miss installing something? Can someone tell me what I'm >>> doing wrong? >> >> Nope, I did something wrong. Fix coming in a bit. Thanks. Missed a >> git add . sigh. :( > > k, it should be fixed. I didn't bump the version as it was a > completely fatal bug to the dist. =\ > > Thank you very much for sending out a message. I *did* test the > release a *lot*, but forget to run tests on the actual extracted > tarball. sigh. ------------------------------------------------------ Marco A. Gonzalez Amagavi, Inc. - Developer of database-driven web sites web: http://www.amagavi.com/ email on iPhone: marcoinc at mac.com email on laptop: marco at amagavi.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From WahMeng at freescale.com Tue Apr 7 13:36:40 2009 From: WahMeng at freescale.com (Wong Wah Meng-R32813) Date: Tue, 7 Apr 2009 19:36:40 +0800 Subject: [DB-SIG] ORA-03113: end-of-file on communication channel\012 error In-Reply-To: References: Message-ID: <73839B4A0818E747864426270AC332C303ED85D1@zmy16exm20.fsl.freescale.net> Hello guys, I would like to post a question on an issue that I have encountered on an AIX 5.3 box. I intermittently encountered this issue when my application access to database. Based on my troubleshooting with Oracle DBA, I think I can rule out the cause of this is in the Oracle, as the SQL does pass through Oracle PARSE, EXECUTE and FETCH phase. There is no way I can verify this at network level as both my application and Oracle database reside on the same server. I think the rootcause of this issue might be related to the stability of the oracledb object that my team built on a AIX 4 box on python 1.5.2 binary back in year 2000. I also suspected this issue happens when there is simultaneous access to database from multiple threads spawned off in my application. Here is a little more background. I have been running the python binary and oracledb binary without much issue on another AIX 5.2 box. Oracle version is 9i on both AIX servers. We are using lib32 of ORACLE since the oracledb cannot run when I pointed the LIBPATH for Oracle to lib (default on Oracle 9 is 64 bit). Does anyone has encountered this issue in the similar environment like mine before? Due to lack of knowledge in recompiling python on the UNIX platform, I didn't try out recompiling, though I do not rule out this might be one of the root causes why I encounter this error. Can anyone share your input if you have encountered this before and how to further verify the problem or how to resolve this problem? I will really appreciate it. Below is the trace log of my application and the trace log in Oracle. Thanks! Regards, Wah Meng zmy16aix06:/efm/raesta/Product/Log>grep nonPPTLotClass debug.log.1 Mar 19 17:06:57 DbAccessMgr ('Thread #7', 'Reconnecting to Oracle due to Oracle error: PARSE caused a ORA-03113: end-of-file on communication channel\012', ("select PARM_VALUE from MES_PARAMETER_VALUES where PARM_OWNER_TYPE = 'APPL' and PARM_OWNER = 'MaterialMgr' and PARM_NAME = 'nonPPTLotClass' and rownum = 1", None)) zmy16aix06:/tmp> cat prefmol7_ora_1781858.txt select PARM_VALUE from MES_PARAMETER_VALUES where PARM_OWNER_TYPE = 'APPL' and PARM_OWNER = 'MaterialMgr' and PARM_NAME = 'nonPPTLotClass' and rownum = 1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.01 0.72 0 0 0 0 Execute 2 0.00 0.01 0 0 0 0 Fetch 1 0.00 0.00 0 4 0 1 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 4 0.01 0.74 0 4 0 1 Misses in library cache during parse: 1 Optimizer goal: CHOOSE Parsing user id: 75 czmy16aix06:/efm/raesta/Product/Log>d /tmp zmy16aix06:/tmp>cat prefmol7_ora_1781858.trc /opt/oracle/product/9.2/admin/PREFMOL7/udump/prefmol7_ora_1781858.trc Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit Production JServer Release 9.2.0.7.0 - Production ORACLE_HOME = /opt/oracle/product/9.2 System name: AIX Node name: zmy16aix06 Release: 3 Version: 5 Machine: 000CA28CD600 Instance name: PREFMOL7 Redo thread mounted by this instance: 1 Oracle process number: 302 Unix process pid: 1781858, image: oracle at zmy16aix06 (TNS V1-V3) *** 2009-03-19 17:07:21.705 *** SESSION ID:(227.12465) 2009-03-19 17:07:21.369 APPNAME mod='python at zmy16aix06 (TNS V1-V3)' mh=0 act='' ah=0 ===================== PARSING IN CURSOR #2 len=153 dep=0 uid=75 oct=3 lid=75 tim=68684146214852 hv=762 989930 ad='34dc15b0' select PARM_VALUE from MES_PARAMETER_VALUES where PARM_OWNER_TYPE = 'APPL' and P ARM_OWNER = 'MaterialMgr' and PARM_NAME = 'nonPPTLotClass' and rownum = 1 END OF STMT PARSE #2:c=10000,e=723600,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=6868414588686 7 EXEC #2:c=0,e=13118,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=68684146328635 EXEC #2:c=0,e=44,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=68684146333105 FETCH #2:c=0,e=6781,p=0,cr=4,cu=0,mis=0,r=1,dep=0,og=4,tim=68684146339922 zmy16aix06:/tmp> From Dennis.Benzinger at gmx.net Tue Apr 7 14:26:41 2009 From: Dennis.Benzinger at gmx.net (Dennis Benzinger) Date: Tue, 07 Apr 2009 14:26:41 +0200 Subject: [DB-SIG] ORA-03113: end-of-file on communication channel\012 error In-Reply-To: <73839B4A0818E747864426270AC332C303ED85D1@zmy16exm20.fsl.freescale.net> References: <73839B4A0818E747864426270AC332C303ED85D1@zmy16exm20.fsl.freescale.net> Message-ID: <49DB4681.8080800@gmx.net> Am 07.04.2009 13:36, Wong Wah Meng-R32813 schrieb: > Hello guys, > > I would like to post a question on an issue that I have encountered on > an AIX 5.3 box. I intermittently encountered this issue when my > application access to database. Based on my troubleshooting with Oracle > DBA, I think I can rule out the cause of this is in the Oracle, as the > SQL does pass through Oracle PARSE, EXECUTE and FETCH phase. There is no > way I can verify this at network level as both my application and Oracle > database reside on the same server. > [...] Did you try executing your statement from another computer? (Perhaps with SQL*Plus?) Dennis Benzinger From marcoinc at mac.com Tue Apr 7 20:55:47 2009 From: marcoinc at mac.com (Marco A. Gonzalez) Date: Tue, 07 Apr 2009 14:55:47 -0400 Subject: [DB-SIG] SQLAlchemy and py-postgresql? In-Reply-To: References: Message-ID: <44291728-546A-4130-AD4C-F7DA89CA544F@mac.com> I'm trying to understand all the different pieces I need to use a database from Python, and I found SQLAlchemy and it seems "good" (without really knowing what I'm talking about yet.) I understand that py-postgresql provides a DB-API 2.0 interface for using a PostgreSQL database. However, when I read about SQLAlchemy at http://www.sqlalchemy.org/docs/05/dbengine.html#supported-dbapis I saw that it uses psycopg2 for supporting Postgres. Is there a reason I can't use py-postgresql with SQLAlchemy? What's the relationship between the py-postgresql and SQLAlchemy and psycopg2? ------------------------------------------------------ Marco A. Gonzalez, President Amagavi, Inc., Developer of database-driven web sites web: http://www.amagavi.com/ email: marcoinc at mac.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mal at egenix.com Tue Apr 7 23:27:26 2009 From: mal at egenix.com (M.-A. Lemburg) Date: Tue, 07 Apr 2009 23:27:26 +0200 Subject: [DB-SIG] PEP 249 In-Reply-To: <49CEB58B.6000604@humval.com> References: <49CEB58B.6000604@humval.com> Message-ID: <49DBC53E.7080105@egenix.com> On 2009-03-29 00:40, Adam wrote: > Suggestion: > Cursor execute function return self (cursor) to allow for code like: > cursor.execute(SQL).fetchall() > instead of > cursor.execute(SQL) > cursor.fetchall() DB-API modules are free to implement this. The cursor.execute() return value is not defined in the spec (it is deliberately undefined). -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Apr 07 2009) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2009-03-19: Released mxODBC.Connect 1.0.1 http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ From lists at jwp.name Wed Apr 8 00:28:46 2009 From: lists at jwp.name (James Pye) Date: Tue, 7 Apr 2009 15:28:46 -0700 Subject: [DB-SIG] SQLAlchemy and py-postgresql? In-Reply-To: <44291728-546A-4130-AD4C-F7DA89CA544F@mac.com> References: <44291728-546A-4130-AD4C-F7DA89CA544F@mac.com> Message-ID: On Apr 7, 2009, at 11:55 AM, Marco A. Gonzalez wrote: > I understand that py-postgresql provides a DB-API 2.0 interface for > using a PostgreSQL database. However, when I read about SQLAlchemy > at http://www.sqlalchemy.org/docs/05/dbengine.html#supported-dbapis > I saw that it uses psycopg2 for supporting Postgres. py-postgresql only supports Python 3.0. Both are very new. psycopg2 only supports Python 2.x, AFAIK. If you are wanting to use sqlalchemy with Python 3 and PostgreSQL, py-postgresql and pg8000 would be your only "hopes", atm.. > Is there a reason I can't use py-postgresql with SQLAlchemy? What's > the relationship between the py-postgresql and SQLAlchemy and > psycopg2? Depends. Does SQLAlchemy support Python 3? psycopg2 and py-postgresql are completely different projects, so there will naturally be inconsistencies despite their DB-API conformance. *If* SQLAlchemy supports Python 3, it may be as easy as switching out a module path in some config file, but that is unlikely. That said, if you want to use SQLAlchemy, you will probably need to use psycopg2. From cito at online.de Wed Apr 8 10:16:33 2009 From: cito at online.de (Christoph Zwerschke) Date: Wed, 08 Apr 2009 10:16:33 +0200 Subject: [DB-SIG] SQLAlchemy and py-postgresql? In-Reply-To: References: <44291728-546A-4130-AD4C-F7DA89CA544F@mac.com> Message-ID: <49DC5D61.1070205@online.de> James Pye schrieb: > Depends. Does SQLAlchemy support Python 3? No, that will still take some time. See http://groups.google.com/group/sqlalchemy/browse_thread/thread/b4dbc90ccf6ffdfb -- Christoph From WahMeng at freescale.com Wed Apr 8 11:56:24 2009 From: WahMeng at freescale.com (Wong Wah Meng-R32813) Date: Wed, 8 Apr 2009 17:56:24 +0800 Subject: [DB-SIG] ORA-03113: end-of-file on communication channel\012 error In-Reply-To: <49DB4681.8080800@gmx.net> References: <73839B4A0818E747864426270AC332C303ED85D1@zmy16exm20.fsl.freescale.net> <49DB4681.8080800@gmx.net> Message-ID: <73839B4A0818E747864426270AC332C303F1D9F7@zmy16exm20.fsl.freescale.net> Yes I did. There is no problem in executing the SQL in a SQLPLUS session. In fact, I would say the hit ratio of this error is less than 0.01% (1/10,000) of the number of SQL that is executed by the oracledb in my application. Regards, Wah Meng -----Original Message----- From: db-sig-bounces+wahmeng=freescale.com at python.org [mailto:db-sig-bounces+wahmeng=freescale.com at python.org] On Behalf Of Dennis Benzinger Sent: Tuesday, April 07, 2009 8:27 PM To: Wong Wah Meng-R32813 Cc: db-sig at python.org Subject: Re: [DB-SIG] ORA-03113: end-of-file on communication channel\012 error Am 07.04.2009 13:36, Wong Wah Meng-R32813 schrieb: > Hello guys, > > I would like to post a question on an issue that I have encountered on > an AIX 5.3 box. I intermittently encountered this issue when my > application access to database. Based on my troubleshooting with > Oracle DBA, I think I can rule out the cause of this is in the Oracle, > as the SQL does pass through Oracle PARSE, EXECUTE and FETCH phase. > There is no way I can verify this at network level as both my > application and Oracle database reside on the same server. > [...] Did you try executing your statement from another computer? (Perhaps with SQL*Plus?) Dennis Benzinger _______________________________________________ DB-SIG maillist - DB-SIG at python.org http://mail.python.org/mailman/listinfo/db-sig