jupylite-duckdb


Namejupylite-duckdb JSON
Version 0.0.17 PyPI version JSON
download
home_pagehttps://github.com/iqmo-org/
SummaryTesting
upload_time2023-04-22 17:32:22
maintainer
docs_urlNone
authoriqmo
requires_python
license
keywords jupyterlite duckdb wasm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Experimental
This is highly experimental and will change frequently. 

# jupyterlite_duckdb_wasm
Python wrapper to run DuckDB_WASM within JupyterLite with a Pyodide Kernel

See [notebooks](https://github.com/iqmo-org/jupylite_duckdb/tree/main/notebooks) for example of running this within [jupyterlite](https://jupyter.org/try-jupyter/lab/)

## Cell Magic %%dql
Following the example of [magic_duckdb](https://github.com/iqmo-org/magic_duckdb), there's an initial proof of concept for a duckdb for JupyterLite. 
See [Magic Example](https://github.com/iqmo-org/jupylite_duckdb/blob/main/notebooks/examples_magics.ipynb)

## You can also test directly on pyodide

[pyodide console](https://pyodide.org/en/stable/console.html)

```
import micropip;
await micropip.install('pandas');
await micropip.install('jupylite-duckdb');
import jupylite_duckdb as jd;
conn = await jd.connect();
r1 = await jd.query("pragma version", conn);
r2 = await jd.query("create or replace table xyz as select * from 'https://raw.githubusercontent.com/Teradata/kylo/master/samples/sample-data/parquet/userdata2.parquet'", conn);
r3 = await jd.query("select gender, count(*) as c from xyz group by gender", conn);
print(r1);
print(r2);
print(r3);
```


## Some development notes
- There's some (well known) CORS considerations when trying to load data from other sites. Examples here are all using public sites, there's some limits that to address with your own jupyterlite deployment 
- If you're adding local .py files, use [importlib.invalidate_caches()](https://pyodide.org/en/stable/usage/faq.html#why-can-t-i-import-a-file-i-just-wrote-to-the-file-system). Even then, it was flaky to import.
- Careful with caching... %pip install will pull from browser cache. I had to clear frequently within dev tools
- To clear local storage, which is annoyingly persistent, https://superuser.com/questions/519628/clear-html5-local-storage-on-a-specific-page

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/iqmo-org/",
    "name": "jupylite-duckdb",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "jupyterlite duckdb wasm",
    "author": "iqmo",
    "author_email": "info@iqmo.com",
    "download_url": "",
    "platform": null,
    "description": "# Experimental\r\nThis is highly experimental and will change frequently. \r\n\r\n# jupyterlite_duckdb_wasm\r\nPython wrapper to run DuckDB_WASM within JupyterLite with a Pyodide Kernel\r\n\r\nSee [notebooks](https://github.com/iqmo-org/jupylite_duckdb/tree/main/notebooks) for example of running this within [jupyterlite](https://jupyter.org/try-jupyter/lab/)\r\n\r\n## Cell Magic %%dql\r\nFollowing the example of [magic_duckdb](https://github.com/iqmo-org/magic_duckdb), there's an initial proof of concept for a duckdb for JupyterLite. \r\nSee [Magic Example](https://github.com/iqmo-org/jupylite_duckdb/blob/main/notebooks/examples_magics.ipynb)\r\n\r\n## You can also test directly on pyodide\r\n\r\n[pyodide console](https://pyodide.org/en/stable/console.html)\r\n\r\n```\r\nimport micropip;\r\nawait micropip.install('pandas');\r\nawait micropip.install('jupylite-duckdb');\r\nimport jupylite_duckdb as jd;\r\nconn = await jd.connect();\r\nr1 = await jd.query(\"pragma version\", conn);\r\nr2 = await jd.query(\"create or replace table xyz as select * from 'https://raw.githubusercontent.com/Teradata/kylo/master/samples/sample-data/parquet/userdata2.parquet'\", conn);\r\nr3 = await jd.query(\"select gender, count(*) as c from xyz group by gender\", conn);\r\nprint(r1);\r\nprint(r2);\r\nprint(r3);\r\n```\r\n\r\n\r\n## Some development notes\r\n- There's some (well known) CORS considerations when trying to load data from other sites. Examples here are all using public sites, there's some limits that to address with your own jupyterlite deployment \r\n- If you're adding local .py files, use [importlib.invalidate_caches()](https://pyodide.org/en/stable/usage/faq.html#why-can-t-i-import-a-file-i-just-wrote-to-the-file-system). Even then, it was flaky to import.\r\n- Careful with caching... %pip install will pull from browser cache. I had to clear frequently within dev tools\r\n- To clear local storage, which is annoyingly persistent, https://superuser.com/questions/519628/clear-html5-local-storage-on-a-specific-page\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Testing",
    "version": "0.0.17",
    "split_keywords": [
        "jupyterlite",
        "duckdb",
        "wasm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "720c1deb7a4e3d41c43cd1b5a8a0131b4e9eec159c63d636c43f37f18c99681e",
                "md5": "7397d867b9f3d21842e2b9440b6152b1",
                "sha256": "d7607e054a6c026140eb10007e3228f2a6296472623b9270782cfe004a438e74"
            },
            "downloads": -1,
            "filename": "jupylite_duckdb-0.0.17-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7397d867b9f3d21842e2b9440b6152b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7006,
            "upload_time": "2023-04-22T17:32:22",
            "upload_time_iso_8601": "2023-04-22T17:32:22.788040Z",
            "url": "https://files.pythonhosted.org/packages/72/0c/1deb7a4e3d41c43cd1b5a8a0131b4e9eec159c63d636c43f37f18c99681e/jupylite_duckdb-0.0.17-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-22 17:32:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "jupylite-duckdb"
}
        
Elapsed time: 0.08399s