Package: asqlcell
Analytical SQL CellFor the last decade, the data ecosystem has mainly focused on the technologies to store and process big datasets — the bigger the better. Later on, Modern Data Stack emerged as a cloud-native suite of products used for data integration and data analytics by the more technology-forward companies. Data warehouses are now a default piece of the Modern Data Stack and Snowflake’s rapid rise has been the poster child of this trend.But in real life, most analytical workloads aren’t massive. Users prefer easy and fast answers to their questions instead of waiting for the cloud to spin. Instead of a distributed database in the cloud, most analyses can be handled with an optimized engine on our laptop and the cloud can be leveraged when needed.To fill the gap, we built Analytical SQL Cell, a free and open-source Jupyter Widget that offers a Personal Data Lake experience for Jupyter Notebook users.Analytical SQL has the following features:Pain-free setup (pip install asqlcell and you are in).Unleash the power of SQL for analytical workloads.Lightning speed for data loading.Built-in visualization.Low footprint for analytical processing.Interleave Python and SQL programming.Free and open source.InstallationYou can install usingpip:pipinstallasqlcellQuick StartHere's a quick example to get you started with Analytical SQL Cell in Jupyter:%%sqlSELECTcontinent,AVG(life_exp)AShealth,AVG(gdp_cap)ASwealth,SUM(population)ASpopulationFROM'gapminder.csv.gz'WHEREyear=2007GROUPBYcontinentIn the above sample,%%sqlis a cell magic indicating that the cell block will be executed as a SQL statement. File are used as data source for querying with SQL.Data LoadYou can query from Pandas DataFrame, CSV files, compressed (e.g. compressed with gzip) CSV files, as well as Parquet files.SQLDuckDB is the default engine of Analytical SQL Cell. Please find more details at theSQL Introductionof DuckDB.Result TableWith the SQL query being executed in an Analytical SQL Cell, the result set is presented as a table.Chart BuilderYou can further visualize the result set by clicking the Chart tab.Here are the chart types supported:Column chartBar chartLine chartArea chartScatter chartPie chartCombo chartFunnel chartSunburst chartTutorialIntroductionWorld Development in NumbersVisualise Netflix Data With Analytical SQLLearn SQL with Jupyter LabBusiness Questions on Chinook Music StoreUse the Right Chart for Data VisualizationDevelopmentThis widget is developed with conda to ensure a consistent developer experience. The project is developed in both
Mac OS and Windows Subsystem for Linux.Please run the following commands to create a conda environment:condacreate-nasqlcell-cconda-forgenodejs=18.15python=3.8jupyterlab=3.6jupyter_packaging=0.12
condaactivateasqlcellPythonInstall the python. This will also build the TypeScript package.pipinstall-e".[test, examples, docs]"JupyterWhen developing your extensions, you need to manually enable your extensions with the notebook / lab frontend.For lab, this is done by the command:jupyter labextension develop --overwrite .
jlpm run buildTypescriptYou must start watching the change of the widget:jlpmrunwatchThen in another terminal you can run Jupyter Lab (without launching a browser):jupyterlab--no-browserNow you can open Google Chrome and navigate tohttp://localhost:8888to play with the widget.
After a change wait for the build to finish and then refresh your browser and the changes should take effect.If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.