# Analytical SQL Cell
For 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.
## Installation
You can install using `pip`:
```bash
pip install asqlcell
```
## Quick Start
Here's a quick example to get you started with Analytical SQL Cell in Jupyter:
```sql
%%sql
SELECT
continent,
AVG(life_exp) AS health,
AVG(gdp_cap) AS wealth,
SUM(population) AS population
FROM 'gapminder.csv.gz'
WHERE year=2007
GROUP BY continent
```
In the above sample, `%%sql` is 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.
![Screenshot](gapminder.gif)
### Data Load
You can query from Pandas DataFrame, CSV files, compressed (e.g. compressed with gzip) CSV files, as well as Parquet files.
### SQL
DuckDB is the default engine of Analytical SQL Cell. Please find more details at the [SQL Introduction](https://duckdb.org/docs/sql/introduction) of DuckDB.
### Result Table
With the SQL query being executed in an Analytical SQL Cell, the result set is presented as a table.
![Result Table](result-table.png)
### Chart Builder
You can further visualize the result set by clicking the Chart tab.
![Chart Builder](chart-builder.png)
Here are the chart types supported:
* Column chart
* Bar chart
* Line chart
* Area chart
* Scatter chart
* Pie chart
* Combo chart
* Funnel chart
* Sunburst chart
### Tutorial
- [Introduction](examples/introduction.ipynb)
- [World Development in Numbers](examples/gapminder.ipynb)
- [Visualise Netflix Data With Analytical SQL](examples/netflix.ipynb)
- [Learn SQL with Jupyter Lab](examples/chinook.sqlite.ipynb)
- [Business Questions on Chinook Music Store](examples/chinook.duckdb.ipynb)
- [Use the Right Chart for Data Visualization](examples/visualization.ipynb)
## Development
This 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:
```bash
conda create -n asqlcell -c conda-forge nodejs=18.15 python=3.8 jupyterlab=3.6 jupyter_packaging=0.12
conda activate asqlcell
```
### Python
Install the python. This will also build the TypeScript package.
```bash
pip install -e ".[test, examples, docs]"
```
### Jupyter
When 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 build
```
#### Typescript
You must start watching the change of the widget:
```bash
jlpm run watch
```
Then in another terminal you can run Jupyter Lab (without launching a browser):
```bash
jupyter lab --no-browser
```
Now you can open Google Chrome and navigate to [http://localhost:8888](http://localhost:8888) to 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/datarho/asqlcell",
"name": "asqlcell",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "Jupyter, Widgets, IPython",
"author": "qizh",
"author_email": "qizh@datarho.tech",
"download_url": null,
"platform": "Linux",
"description": "# Analytical SQL Cell\n\nFor the last decade, the data ecosystem has mainly focused on the technologies to store and process big datasets \u2014 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\u2019s rapid rise has been the poster child of this trend.\n\nBut in real life, most analytical workloads aren\u2019t 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.\n\nTo 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.\n\nAnalytical SQL has the following features:\n\n* Pain-free setup (pip install asqlcell and you are in).\n* Unleash the power of SQL for analytical workloads.\n* Lightning speed for data loading.\n* Built-in visualization.\n* Low footprint for analytical processing.\n* Interleave Python and SQL programming.\n* Free and open source.\n\n## Installation\n\nYou can install using `pip`:\n\n```bash\npip install asqlcell\n```\n\n## Quick Start\n\nHere's a quick example to get you started with Analytical SQL Cell in Jupyter:\n\n```sql\n%%sql\n\nSELECT\n continent,\n AVG(life_exp) AS health,\n AVG(gdp_cap) AS wealth,\n SUM(population) AS population\nFROM 'gapminder.csv.gz'\nWHERE year=2007\nGROUP BY continent\n```\n\nIn the above sample, `%%sql` is 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.\n\n![Screenshot](gapminder.gif)\n\n### Data Load\n\nYou can query from Pandas DataFrame, CSV files, compressed (e.g. compressed with gzip) CSV files, as well as Parquet files.\n\n### SQL\n\nDuckDB is the default engine of Analytical SQL Cell. Please find more details at the [SQL Introduction](https://duckdb.org/docs/sql/introduction) of DuckDB.\n\n### Result Table\n\nWith the SQL query being executed in an Analytical SQL Cell, the result set is presented as a table.\n\n![Result Table](result-table.png)\n\n### Chart Builder\n\nYou can further visualize the result set by clicking the Chart tab.\n\n![Chart Builder](chart-builder.png)\n\nHere are the chart types supported:\n\n* Column chart\n* Bar chart\n* Line chart\n* Area chart\n* Scatter chart\n* Pie chart\n* Combo chart\n* Funnel chart\n* Sunburst chart\n\n### Tutorial\n\n- [Introduction](examples/introduction.ipynb)\n- [World Development in Numbers](examples/gapminder.ipynb)\n- [Visualise Netflix Data With Analytical SQL](examples/netflix.ipynb)\n- [Learn SQL with Jupyter Lab](examples/chinook.sqlite.ipynb)\n- [Business Questions on Chinook Music Store](examples/chinook.duckdb.ipynb)\n- [Use the Right Chart for Data Visualization](examples/visualization.ipynb)\n\n## Development\n\nThis widget is developed with conda to ensure a consistent developer experience. The project is developed in both\nMac OS and Windows Subsystem for Linux.\n\nPlease run the following commands to create a conda environment:\n\n```bash\nconda create -n asqlcell -c conda-forge nodejs=18.15 python=3.8 jupyterlab=3.6 jupyter_packaging=0.12\nconda activate asqlcell\n```\n\n### Python\n\nInstall the python. This will also build the TypeScript package.\n\n```bash\npip install -e \".[test, examples, docs]\"\n```\n\n### Jupyter\n\nWhen developing your extensions, you need to manually enable your extensions with the notebook / lab frontend.\n\nFor lab, this is done by the command:\n\n```\njupyter labextension develop --overwrite .\njlpm run build\n```\n\n#### Typescript\n\nYou must start watching the change of the widget:\n\n```bash\njlpm run watch\n```\n\nThen in another terminal you can run Jupyter Lab (without launching a browser):\n\n```bash\njupyter lab --no-browser\n```\n\nNow you can open Google Chrome and navigate to [http://localhost:8888](http://localhost:8888) to play with the widget.\nAfter a change wait for the build to finish and then refresh your browser and the changes should take effect.\n\nIf you make a change to the python code then you will need to restart the notebook kernel to have it take effect.\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "Analytical sql cell for Jupyter",
"version": "0.3.1.0",
"project_urls": {
"Homepage": "https://github.com/datarho/asqlcell"
},
"split_keywords": [
"jupyter",
" widgets",
" ipython"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a316a5e1d8e88f01c836e5cb639c6f785a5e1fa8020e26706c4c2a5d845c4a40",
"md5": "5319c13baae2b1411378c2bfa79c7dc4",
"sha256": "7710b83b5a0c520cd5f7d3356d76c7465cc4fbba3f2fb771be1ef4c8399c65c1"
},
"downloads": -1,
"filename": "asqlcell-0.3.1.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "5319c13baae2b1411378c2bfa79c7dc4",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 7973515,
"upload_time": "2024-06-18T06:25:00",
"upload_time_iso_8601": "2024-06-18T06:25:00.311366Z",
"url": "https://files.pythonhosted.org/packages/a3/16/a5e1d8e88f01c836e5cb639c6f785a5e1fa8020e26706c4c2a5d845c4a40/asqlcell-0.3.1.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-18 06:25:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "datarho",
"github_project": "asqlcell",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "asqlcell"
}