Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install zope.psycopgda

How to install zope.psycopgda

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install zope.psycopgda
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.1.1 Available View build log
Windows (64-bit)
1.1.1 Available View build log
Mac OS X (10.5+)
1.1.1 Available View build log
Linux (32-bit)
1.1.1 Available View build log
Linux (64-bit)
1.1.1 Available View build log
 
License
ZPL 2.1
Imports
Lastest release
version 1.1.1 on Jan 5th, 2011

psycopgda

This file outlines the basics of using Zope3 with PostgreSQL via PsycopgDA.

Installing PsycopgDA

1. Check out the psycopgda package into a directory in your PYTHONPATH. INSTANCE_HOME/lib/python or Zope3/src is usually the most convenient place:

svn co svn://svn.zope.org/repos/main/psycopgda/trunk/psycopgda psycopgda

2. Copy psycopg-configure.zcml to the package-includes directory of your Zope instance.

You can also use the eggified version, by installing it sitewide:

easy_install -U psycopgda

If you're using buildout, just by listing psycopgda in the 'eggs' key of your buildout.cfg, then buildout should be able to find and fetch it.

Creating Database Connections

It is time to add some connections. A connection in Zope 3 is registered as a utility.

3. Open a web browser on your Zope root folder (http://localhost:8080/ if you use the default settings in zope.conf.in).

4. Click on the 'Manage Site' action on the right side of the screen. You should see a screen which reads 'Common Site Management Tasks'

5. Around the middle of that page, you should see a link named 'Add Utility'. Click on it.

  1. Select 'Psycopg DA' and type in a name at the bottom of the page.
  2. Enter the database connection string. It looks like this:

dbi://username:password@host:port/databasename

  1. Click on the 'Add' button.

9. You should be on a page which reads 'Add Database Connection Registration'. There you can configure the permission needed to use the database connection, the name of the registration and the registration status. You can use any name for 'Register As' field, as long as it doesn't clash with an existing one. Choose a permission. Choose between 'Registered' and 'Active' for the 'Registration Status'. Only one component of a kind can be 'Active' at a time, so be careful.

10. You should be redirected to the 'Edit' screen of the connection utility.

11. If you want to, you can go to the Test page and execute arbitrary SQL queries to see whether the connection is working as expected.

Using SQL Scripts

You can create SQL Scripts in the content space. For example:

  1. Go to Zope root.

13. Add an SQL script (you can use the Common Tasks box on the left, or the Add action on the right).

  1. Click on the name of your new SQL script.

15. Choose a connection name (the one you entered in step 29) from the drop-down.

  1. Enter your query and click on the 'Save Changes' button.
  2. You can test the script in the -- surprise! -- Test page.

CHANGES

1.1.1 (2008/01/26)
  • Bug: Some classes were incorrectly looked up.
1.1.0 (2008/01/26)
  • Feature: Produced a real egg.
  • Restructuring: Moved from psycopgda to zope.psycopgda.
  • Bug: Fixed issue 561: PsycopgDA ForbiddenAttribute exception.

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.