How to specify postgresql sqlalchemy.dburi instead of sqlite sqlalchemy.url in development.ini

2,921 views
Skip to first unread message

Chris Leonello

unread,
Mar 1, 2008, 10:20:49 AM3/1/08
to TurboGears Trunk
Hi,

I have installed the latest development versions of pylons and TG2 and
quickstarted a project. I am using a PostgreSQL database. When, in
the development.ini I specify the dburi and comment out the url:

sqlalchemy.dburi="postgres://duser@localhost/workloadmodel"
#sqlalchemy.url = sqlite:///%(here)s/devdata.db

and do a paster serve --reload development.ini I get:

File "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.4.3-
py2.5.egg/sqlalchemy/engine/__init__.py", line 190, in
engine_from_config
url = opts.pop('url')
KeyError: 'url'


If instead in the development.ini I specify:

sqlalchemy.url = "postgres://duser@localhost/workloadmodel"

I get:

File "/opt/local/lib/python2.5/site-packages/SQLAlchemy-0.4.3-
py2.5.egg/sqlalchemy/engine/url.py", line 192, in _parse_rfc1738_args
"Could not parse rfc1738 URL from string '%s'" % name)
sqlalchemy.exceptions.ArgumentError: Could not parse rfc1738 URL from
string ''postgres://duser@localhost/workloadmodel''


What am I missing? How do I specify a dburi and use a database
besides sqlite with TG2?

Chris Leonello

unread,
Mar 1, 2008, 7:08:35 PM3/1/08
to TurboGears Trunk
This was simply a typo on my part. the sqlalchemy.url should not be a
quoted. I just had to use:

sqlalchemy.url = postgres://duser@localhost/workloadmodel

and comment out the sqlalchemy.dburi. The comments in the
development.ini file are somewhat confusing, as it has examples of
sqlalchemy.dburi for postgres and mysql, which don't work.
Reply all
Reply to author
Forward
0 new messages