# ipython-iris-magic
%%iris magic for IPython, can run ObjectScript command in Notebooks.
It can be run in any Notebook and does not require any special setup on IRIS or the Notebook.
## Demo
<img width="1153" alt="image" src="https://user-images.githubusercontent.com/47849411/205066143-8273ad36-b148-4111-9525-4801ce341456.png">
As you can see, the first line load the magic, the second line connect to the server, the third line run the ObjectScript command.
All of this demo is in the example/Notebooks/Demo-Iris-Magic.ipynb
To run the demo run the following command in the root of the project:
```bash
docker-compose up
```
Then go to this url: http://127.0.0.1:8888/notebooks/Demo-Iris-Magic.ipynb
### Load the magic
```python
%load_ext iris_magic
```
### Connect to the server
```python
%%iris iris://superuser:SYS@localhost:1972/USER
```
### Run the ObjectScript command
```python
%%iris
Set x = 1
Write x
```
## Installation
In order to use this magic, you need to install the [ipython-iris-magic](https://pypi.python.org/pypi/ipython-iris-magic) package.
```bash
pip install ipython-iris-magic
```
All the dependencies will be installed automatically.
## Usage
```python
%load_ext iris_magic
```
```python
%%iris iris://superuser:SYS@localhost:1972/USER
set test = "toto"
zw test
```
Output:
```text
test="toto"
```
You can also use the magic to run SQL query.
### Load the magic
```python
%load_ext sql
```
/!\ You need to install the sql extension first.
The sql extension is not part of the standard IPython installation. You can install it with the following command:
```bash
pip install ipython-sql
```
### Connect to the server
```python
%sql iris://superuser:SYS@localhost:1972/USER
```
### Run the SQL query
```python
%sql SELECT 1
```
Raw data
{
"_id": null,
"home_page": "https://github.com/grongierisc/ipython-iris-magic",
"name": "ipython-iris-magic",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "ipython-iris-magic",
"author": "grongier",
"author_email": "guillaume.rongier@intersystems.com",
"download_url": "https://files.pythonhosted.org/packages/5a/5d/7542a538752714d0bb81ec7b76386c8a4ac23c6e515492cca665f1480537/ipython-iris-magic-0.0.8.tar.gz",
"platform": null,
"description": "# ipython-iris-magic\n\n%%iris magic for IPython, can run ObjectScript command in Notebooks.\n\nIt can be run in any Notebook and does not require any special setup on IRIS or the Notebook.\n\n## Demo\n\n<img width=\"1153\" alt=\"image\" src=\"https://user-images.githubusercontent.com/47849411/205066143-8273ad36-b148-4111-9525-4801ce341456.png\">\n\nAs you can see, the first line load the magic, the second line connect to the server, the third line run the ObjectScript command.\n\nAll of this demo is in the example/Notebooks/Demo-Iris-Magic.ipynb\n\nTo run the demo run the following command in the root of the project:\n\n```bash\ndocker-compose up\n```\n\nThen go to this url: http://127.0.0.1:8888/notebooks/Demo-Iris-Magic.ipynb\n\n### Load the magic\n\n```python\n%load_ext iris_magic\n```\n\n### Connect to the server\n\n```python\n%%iris iris://superuser:SYS@localhost:1972/USER\n```\n\n### Run the ObjectScript command\n\n```python\n%%iris\nSet x = 1\nWrite x\n```\n## Installation\n\nIn order to use this magic, you need to install the [ipython-iris-magic](https://pypi.python.org/pypi/ipython-iris-magic) package.\n\n```bash\npip install ipython-iris-magic\n```\n\nAll the dependencies will be installed automatically.\n\n\n\n## Usage\n\n```python\n%load_ext iris_magic\n```\n\n```python\n%%iris iris://superuser:SYS@localhost:1972/USER \nset test = \"toto\"\nzw test\n```\n\nOutput:\n\n```text\ntest=\"toto\"\n```\n\n\nYou can also use the magic to run SQL query.\n\n### Load the magic\n\n```python\n%load_ext sql\n```\n\n/!\\ You need to install the sql extension first.\n\nThe sql extension is not part of the standard IPython installation. You can install it with the following command:\n\n```bash\npip install ipython-sql\n```\n\n### Connect to the server\n\n```python\n%sql iris://superuser:SYS@localhost:1972/USER\n```\n\n### Run the SQL query\n\n```python\n%sql SELECT 1\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "ipython-iris-magic",
"version": "0.0.8",
"project_urls": {
"Homepage": "https://github.com/grongierisc/ipython-iris-magic"
},
"split_keywords": [
"ipython-iris-magic"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f92cc24e34bf4ae869acbc7b3c163c2556cc7a343792ce37c927a55094fd8c7",
"md5": "8e373e2cd6980a4ca7ce16bf87661b0c",
"sha256": "11c0fe0da6173c3ca881965a6b24e6b84377f46cd1646fba7d8c8867d13834f0"
},
"downloads": -1,
"filename": "ipython_iris_magic-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e373e2cd6980a4ca7ce16bf87661b0c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 4936,
"upload_time": "2023-12-01T13:37:16",
"upload_time_iso_8601": "2023-12-01T13:37:16.935585Z",
"url": "https://files.pythonhosted.org/packages/2f/92/cc24e34bf4ae869acbc7b3c163c2556cc7a343792ce37c927a55094fd8c7/ipython_iris_magic-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a5d7542a538752714d0bb81ec7b76386c8a4ac23c6e515492cca665f1480537",
"md5": "9809c0657615a59c541b485639ee7511",
"sha256": "990ccb71681bf224ee86d0ea67192dd59f44536ae7b00dce74c06dd86c53e3fd"
},
"downloads": -1,
"filename": "ipython-iris-magic-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "9809c0657615a59c541b485639ee7511",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 4834,
"upload_time": "2023-12-01T13:37:18",
"upload_time_iso_8601": "2023-12-01T13:37:18.266636Z",
"url": "https://files.pythonhosted.org/packages/5a/5d/7542a538752714d0bb81ec7b76386c8a4ac23c6e515492cca665f1480537/ipython-iris-magic-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-01 13:37:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "grongierisc",
"github_project": "ipython-iris-magic",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "ipython-iris-magic"
}