代码之家  ›  专栏  ›  技术社区  ›  Alina

超集无法连接到我的Sqlite数据库

  •  5
  • Alina  · 技术社区  · 8 年前

    我在sqlite中有一个数据库,并遵循 this tutorial 关于如何创建它。我检查过,数据库存在并且包含值。

    我在超集的web界面中输入了以下SQLAlchemy URI: sqlite:///Users/me/Documents/cancellation/item/eventlog.db

    并得到以下错误:

    ERROR: {"error": "Connection failed!\n\nThe error message returned
    was:\n'NoneType' object has no attribute
    'get_password_masked_url_from_uri'"}
    

    如果文档中没有指定密码,我不理解为什么应该有密码:

    http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#sqlite

    代码:

    sqlite_file = 'eventlog.db' # the DB file
    conn = sqlite3.connect(sqlite_file) 
    eventlog.to_sql('eventlog', conn, if_exists='replace', index=False)
    from sqlalchemy import create_engine
    >engine = create_engine('sqlite:////Users/me/Documents/cancellation/item/eventlog.db)
    
    1 回复  |  直到 8 年前
        1
  •  3
  •   mjd    8 年前

    在过去的几天里,这个问题让我发疯。我最终发现,实际上您必须保存数据库配置,然后返回页面以使“测试连接”真正成功。在点击Save之前尝试使用“Test Connection”(测试连接)按钮会产生您列出的错误消息。