Can I use glaredb with %%sql magic (jupyter notebook)? or SQLAlchemy?
Description
I want to sql some delta tables in jupyter notebook without spark session. So, I found glaredb. So, can I use glaredb with %%sql magic?
Just wanted to clarify, are you specifically looking to be able to use %%sql in a notebook, or are you just looking for a way to glaredb in a notebook?
We have python bindings which we've tested in a variety of notebooks. You're able to install using:
!pip install glaredb
And then in another python cell, you can start using glaredb:
import glaredb
con = glaredb.connect()
con.sql("select 'hello'").show()
You can then use CREATE EXTERNAL TABLE (https://docs.glaredb.com/glaredb/sql-commands/create-external-table/#delta) or delta_scan (https://docs.glaredb.com/glaredb/sq-functions/delta_scan/) to read delta tables.
If you're looking specifically for running sql using %%sql, we would need look into that a bit more.
Thank you for your reply! I want to use %%sql in a notebook. for example:
%%sql glaredb://xxx
select 'hello'
or
%%sql
SELECT * FROM 'https://huggingface.co/datasets/fka/awesome-chatgpt-prompts/raw/main/prompts.csv'
Since https://github.com/catherinedevlin/ipython-sql support %%sql feature, but only in sqlalchemy
So, maybe we need a sqlalchemy dialects for glaredb.