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()
everything is okay until this but when i connect to the sqlite
%sql sqlite:///socioeconomic.db
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([])
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
Essentially there are 2 ways you can connect from your Jupyter notebook to SQLite local db. I don't think it relates to your Mac version as I have M2 and it's running fine.
Check you have the .db file locally. Also, check if the same sqlalchemy versions are matching. I believe pip install sqlalchemy==1.4.4 should work. Another reason to move to Jupysql is that it supports the latest SQLAlchemy version.
Here are 2 ways you can make it run via Jupysql:
%sql as follows:some_engine = create_engine("sqlite:///some.db")
%sql some_engine
%sql sqlite:///foo.db
For both options you'll need to set up the correct package and import it via %load_ext sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With