sqlalchemy,creating an sqlite database if it doesn't exist

前端 未结 4 969
日久生厌
日久生厌 2021-02-01 04:05

I am trying out sqlalchemy and i am using this connection string to connect to my databases

engine = create_engine(\'sqlite:///C:\\\\sqlitedbs\\\\database.db\')
         


        
4条回答
  •  执笔经年
    2021-02-01 04:27

    As others have posted, SQLAlchemy will do this automatically. I encountered this error, however, when I didn't use enough slashes!

    I used SQLALCHEMY_DATABASE_URI="sqlite:///path/to/file.db" when I should have used four slashes: SQLALCHEMY_DATABASE_URI="sqlite:////path/to/file.db"

提交回复
热议问题