我最近在Azure上创建了一个Postgres数据库,并且在计算出我的数据库URI时遇到了很多麻烦。 vim的信任状看起来像:无法确定数据库URI Postgres Azure
服务器:name.postgres.database.azure.com
用户(管理员角色):管理员@名
密码:MYPASSWORD
DB名称:Postgres的
所以我试图用psql
,并通过在连接字符串中,psql postgresql://[email protected]:[email protected]:5432/postgres
但它给我一个错误
PSQL:无法解析主机名 “名” 来解决:节点名,也不 servname提供,或者不知道
有趣的是,这个工程:
psql -h name.postgres.database.azure.com -p 5432 -U [email protected] postgres
我之所以问,是因为我想使用Python和sqlalchemy,并希望传入DB uri字符串。
注意,在以下方面与psql连接,按照这里的文档:http://postgresguide.com/utilities/psql.html,我实际上能够使用:'psql“dbname = dbhere host = hosthere user = userhere password = pwhere port = 5432” '。但是,感谢链接到Azure官方教程连接到python与postgres – Vincent
我无法连接通过sqlalchemy。我可以通过psycopg2连接,我认为.. – Vincent
@Vincent你可以发布一个新线程,通过sqlalchemy连接故障吗? –