Psycopg Database Adapter for Zope 3
Project description
psycopgda
This file outlines the basics of using Zope3 with PostgreSQL via PsycopgDA.
Installing PsycopgDA
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
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.
Open a web browser on your Zope root folder (http://localhost:8080/ if you use the default settings in zope.conf.in).
Click on the ‘Manage Site’ action on the right side of the screen. You should see a screen which reads ‘Common Site Management Tasks’
Around the middle of that page, you should see a link named ‘Add Utility’. Click on it.
Select ‘Psycopg DA’ and type in a name at the bottom of the page.
Enter the database connection string. It looks like this:
dbi://username:password@host:port/databasename
Click on the ‘Add’ button.
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.
You should be redirected to the ‘Edit’ screen of the connection utility.
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:
Go to Zope root.
Add an SQL script (you can use the Common Tasks box on the left, or the Add action on the right).
Click on the name of your new SQL script.
Choose a connection name (the one you entered in step 29) from the drop-down.
Enter your query and click on the ‘Save Changes’ button.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file zope.psycopgda-1.1.1.tar.gz
.
File metadata
- Download URL: zope.psycopgda-1.1.1.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3cd05267ba3728fe8a6db7a973dcc2f3918d15a818da1de309fdbf5b01c9f87 |
|
MD5 | fa7b9f912ac302c5dac6060cb0a63ea8 |
|
BLAKE2b-256 | 0f75d22f09ac94b52978c2707390240631e6b27a8c4075c76f3e910ce98d178c |