 <p>This issue was resolved. I didn't know that when using pylons from the CLI, I have to include the entire environment:</p> <pre><code>from paste.deploy import appconfig from pylons import config from project.config.environment import load_environment conf = appconfig('config:development.ini', relative_to='.') load_environment(conf.global_conf, conf.local_conf) from project.model import * </code></pre> <p>After this the database queries executed without a problem.</p>