Ran*_*and 5 sqlite jupyter-notebook
im very new to sqlite, im using macbook m1, im try to use jupyter notebook to do sql here is my code
%load_ext sql
import csv, sqlite3
con = sqlite3.connect("socioeconomic.db")
cur = con.cursor()
Run Code Online (Sandbox Code Playgroud)
everything is okay until this but when i connect to the sqlite
%sql sqlite:///socioeconomic.db
Run Code Online (Sandbox Code Playgroud)
there is error something like this
MetaData.__init__() got an unexpected keyword argument 'bind'
Connection info needed in SQLAlchemy format, example:
postgresql://username:password@hostname/dbname
or an existing connection: dict_keys([])
Run Code Online (Sandbox Code Playgroud)
do you have any suggestion what should i do?
i tried to use other laptop but windows, and the same code works, but in mac isnt
查看本指南!基本上有两种方法可以从 Jupyter Notebook 连接到 SQLite 本地数据库。我认为这与你的 Mac 版本无关,因为我有 M2 并且运行良好。
检查本地是否有 .db 文件。另外,检查相同的 sqlalchemy 版本是否匹配。我相信pip install sqlalchemy==1.4.4应该有效。迁移到 Jupysql 的另一个原因是它支持最新的 SQLAlchemy 版本。
您可以通过以下两种方式运行它Jupysql:
%sql以下位置:some_engine = create_engine("sqlite:///some.db")
%sql some_engine
Run Code Online (Sandbox Code Playgroud)
%sql sqlite:///foo.db
Run Code Online (Sandbox Code Playgroud)
对于这两个选项,您需要设置正确的包并通过以下方式导入它%load_ext sql
| 归档时间: |
|
| 查看次数: |
7177 次 |
| 最近记录: |