Topics
zodburi URI support
A number of applications, most notably Pyramid, use URI syntax to define the ZODB databases they use. Newt DB supports this syntax through the newt scheme.
A newt URI
newt://mydbserver/my_database?keep_history=true&connection_cache_size=100000Newt URIs have roughly the same form as PostgreSQL URI connection strings, except that they use the newt URI scheme instead of the postgresql scheme. The PostgreSQL connection string documentation describes the shared parts.
Extra query parameters
Newt URIs support extra query string parameters:
| Parameter | Meaning |
|---|---|
keep_history | Boolean (true, false, yes, no, 1 or 0) indicating whether records that are no longer current should be kept. This is false by default. |
driver | The PostgreSQL driver name, either psycopg2 or psycopg2cffi. By default the driver is determined automatically. |
connection_cache_size | The target maximum number of objects to keep in the per connection object cache. |
connection_pool_size | The target maximum number of ZODB connections to keep in the connection pool. |
Limitations
There are a number of limitations to be aware of when using the URI syntax.
- Because the zodburi framework can only be used to set up ordinary ZODB databases, the resulting connection objects do not have the extra search or transaction convenience functions provided by Newt DB. When searching, use the Newt search module functions and pass your database connections as the first arguments.
- zodburi provides insufficient control over database configuration. You will end up having to use something else for production deployments.
The zodburi package documents the general resolver and the URI conventions that Newt DB follows.
Use the Python API for production. The URI route is convenient for development and for frameworks that expect a ZODB URI. The text configuration and Python APIs expose the full set of options.