Open larsyencken opened 3 months ago
I got this working as a proof of concept with many hacks, which I could clean up into a PR.
Getting a MySQL connection is not hard, but then it's available at <alias>.<mysql_db_name>
instead of being the default db, which means you need to add USE
statements in front of every cursor creation/execution to make it run cleanly.
In my current proof-of-concept, Datasette fails on /
path, works on /<db>
path and all queries, but fails on /<db>/<table>
path for browsing.
Incidentally, it's amazing to me to have gotten this far in just an hour or two, and I'm super impressed that you put this plugin together. Nice work 🙌
Motivation
Datasette is an amazing frontend UI that only officially supports
sqlite
. Withdatasette-parquet
, a DuckDB backend works pretty well. But DuckDB is also capable of attaching a live MySQL connection with:This opens the door to Datasette over live MySQL, which would be very attractive for many people with an existing MySQL database.
Proposal
Add a
mysql
config option (similar tofile
anddirectory
) that takes all the config needed to create a MySQL connection string in DuckDB (e.g.db_host
, ...), so that datasette works with a live MySQL connection.