我正在尝试连接到 Windows 7 x64 计算机上的 python 3.3 应用程序中的 sqlite-database 文件。为此,文档指出:
# sqlite://<nohostname>/<path>
# where <path> is relative:
engine = create_engine('sqlite:///foo.db')
# or absolute, starting with a slash:
engine = create_engine('sqlite:////absolute/path/to/foo.db')
我想使用绝对路径,windows-相当于什么sqlite:////absolute/path/to/foo.db
?数据库存储在C:/Users/Username/AppData/Roaming/Appname/mydatabase.db
.
任何帮助表示赞赏!
在 Windows 上这有点棘手,因为你必须转义反斜杠:
sqlite:///C:\\path\\to\\database.db
另外,由于Windows没有这个概念root
并使用驱动器,您必须使用 3 个斜杠指定绝对路径:
sqlite:///C:\\Users\\Username\\AppData\\Roaming\\Appname\\mydatabase.db
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)