On Sat, Sep 23, 2006 at 11:08:05AM -0400, Rick Morrison wrote:
> I think that psycopg2 will automatically use a Unix socket if a host address
> is omitted on the connection call. You'd need a way to have SA not supply
> that -- not sure how that would fit in with the dburi way of things. What's
> the big deal with using localhost anyway? I was under the impression that it
> was optimized for most of the Unixen and BSDs out there to be about as fast
> as a socket anyway.
You cannot do it with the URL based syntax.
On 9/23/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
> on my machine, I am able to connect if I simply say:
>
> create_engine('postgres://user:pass@/dbname')
>
> i would assume that its dropping into a unix socket. im not an
> expert at reading the unix sockets listing on OSX's netstat but I
> also see an additional "PGSQL.5432" entry pop up when I run this.
Here is a method that works:
If one runs a postgres server listening _only_ a Unix socket this code
below shows how to connect and SA engine to it.
import sqlalchemy as sa
conn_args = {
'host':'/tmp/pg',
'database':'t-design',
}
db = sa.create_engine('postgres://', connect_args = conn_args)
Cheers,
Steve
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users