On May 13, 2010, at 7:33 AM, Faheem Mitha wrote: > > Hi, > > In > > http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#creating-engines > > it describes how permitted urls are of the form > > dialect://user:passw...@host/dbname[?key=value..], > > I'm using postgresql. I believe sqlalchemy uses psycopg2 by default. > > I've been connecting using psycopg2 via unix socket and ident sameuser, This > does not require either host or password. psycopg2 allows me to leave both > host and password empty. I tested and sqlalchemy barfs if even the password > is not supplied. If I want to use sqlalchemy, what are my options?
Simply don't put a colon: from sqlalchemy import * e = create_engine('postgresql://sc...@localhost/test', echo=True) e.connect() > > Regards, Faheem. > > Traceback (most recent call last): > File "<stdin>", line 8, in <module> > File "dbutils.py", line 41, in dbuser_exists > conn = db.connect() > File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line > 1221, in connect > return self.Connection(self, **kwargs) > File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line > 531, in __init__ > self.__connection = connection or engine.raw_connection() > File "/var/lib/python-support/python2.5/sqlalchemy/engine/base.py", line > 1276, in raw_connection > return self.pool.unique_connection() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 119, in > unique_connection > return _ConnectionFairy(self).checkout() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 304, in > __init__ > rec = self._connection_record = pool.get() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 161, in get > return self.do_get() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 642, in > do_get > con = self.create_connection() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 122, in > create_connection > return _ConnectionRecord(self) > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 198, in > __init__ > self.connection = self.__connect() > File "/var/lib/python-support/python2.5/sqlalchemy/pool.py", line 261, in > __connect > connection = self.__pool._creator() > File "/var/lib/python-support/python2.5/sqlalchemy/engine/strategies.py", > line 80, in connect > raise exc.DBAPIError.instance(None, None, e) > sqlalchemy.exc.OperationalError: (OperationalError) fe_sendauth: no password > supplied > None None > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.