If you’re an enthusiast of Jupyter notebooks, you’ll be pleased to know that Polypheny offers seamless integration with third-party Jupyter tools through a specialized IPython extension. This extension not only simplifies querying Polypheny using multiple query languages but also enhances your data analysis experience with Python.
Polypheny itself comes with a feature-rich Notebook environment that is fully compatible with the Jupyter notebooks format. It allows for seamless execution of queries using specialized query cells. So, if you’re looking for an all-in-one solution, be sure to check out Polypheny’s native Notebook feature.
Installation of the IPython Extension
The simplest way to install the IPython extension for Polypheny is via pip:
pip install ipython-polypheny
For more detailed installation instructions, please consolidate the instructions outlined in the README file.
Basic Usage
To activate the extension within a Jupyter notebook, simply run:
%load_ext poly
You can use both line magics (%poly
) and cell magics (%%poly
) to execute queries. The extension supports multiple query languages and even allows you to specify a namespace or deactivate the cache for a specific query.
For instance:
%%poly sql
SELECT * FROM emps
Or, with more advanced options:
%%poly mql mynamespace -c
db.emps.find({})
You can also expand variables defined in your local namespace into a query using the --template
(or -t
) flag.
key = 'salary'
x = 10000
%% poly -t sql: SELECT * FROM emps WHERE ${key} > ${x}
# is equal to
%% poly sql: SELECT * FROM emps WHERE salary > 10000
Working with the Result
Working with results is similar to the native Polypheny notebooks. Please follow the instructions outlined here.
Limitations
Please note that the extension currently does not support multimedia and other blob types.