Skip to content
Newt DBthe amphibious database

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=100000

Newt 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:

Parameters understood by the newt URI scheme
ParameterMeaning
keep_historyBoolean (true, false, yes, no, 1 or 0) indicating whether records that are no longer current should be kept. This is false by default.
driverThe PostgreSQL driver name, either psycopg2 or psycopg2cffi. By default the driver is determined automatically.
connection_cache_sizeThe target maximum number of objects to keep in the per connection object cache.
connection_pool_sizeThe 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.

URI and framework references