thanosql-magic


Namethanosql-magic JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/smartmind-team/thanosql-magic
SummaryThanoSQL Magic
upload_time2024-03-22 04:52:43
maintainerNone
docs_urlNone
authorDada Ahn
requires_pythonNone
licenseMIT
keywords smartmind thanosql ipython jupyter
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # thanosql-magic

## Introduction

`thanosql-magic` is a Jupyter Notebook extension that provides SQL query capabilities using [ThanoSQL](https://www.thanosql.ai). This magic extension enables users to interact with ThanoSQL Workspace databases using extended SQL syntax within a Jupyter notebook.

`thanosql-magic` uses IPython magic. [IPython magic](https://ipython.readthedocs.io/en/stable/interactive/magics.html) is a special command that can be used in the IPython shell to perform specific tasks before executing the code. Since Jupyter includes the IPython shell, you can also use these magic commands in Jupyter Notebook.

IPython magic commands are prefixed with % or %% and % applies the magic to a single line of code, while %% applies the magic to multiple lines of code.

## Installation

To install thanosql-magic, you can use pip:

```
pip install thanosql-magic
```

Once installed, you can load the extension in your Jupyter notebook by running:

```python
%load_ext thanosql
```

## Usage

After loading the extension, you can connect to your ThanoSQL Engine instance by setting the thanosql variable:

1. Setting API_TOKEN

   ```python
   %thanosql API_TOKEN=<Issued_API_TOKEN>
   ```

1. Changing the Default API URI (Optional)

   ```python
   %thanosql http://localhost:8000/api/v1/query
   ```

3. Using Magic Commands

   You can then execute SQL queries on your Thanos data using the %thanosql magic command:

   ```python
   %%thanosql
   SELECT * FROM users
   ```

   This will run the SQL query and display the results in your Jupyter notebook.

You can also refer to the guide provided in [ThanoSQL's official documentation](https://docs.thanosql.ai/getting_started/hello_ThanoSQL/#3-check-the-list-of-the-thanosql-models-and-datasets-using-the-list-query-syntax).

## Requirements
- Python 3.x
- Jupyter Notebook

## Contributing
If you find any issues or would like to contribute to thanosql-magic, feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/smartmind-team/thanosql-magic).

## License

[MIT](LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/smartmind-team/thanosql-magic",
    "name": "thanosql-magic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "smartmind thanosql ipython jupyter",
    "author": "Dada Ahn",
    "author_email": "dada.ahn@smartmind.team",
    "download_url": "https://files.pythonhosted.org/packages/0d/d8/a32b4cdea2b9265277baf564dcf6c1f953afb7e478cc588f352a1371eccc/thanosql-magic-0.4.0.tar.gz",
    "platform": null,
    "description": "# thanosql-magic\n\n## Introduction\n\n`thanosql-magic` is a Jupyter Notebook extension that provides SQL query capabilities using [ThanoSQL](https://www.thanosql.ai). This magic extension enables users to interact with ThanoSQL Workspace databases using extended SQL syntax within a Jupyter notebook.\n\n`thanosql-magic` uses IPython magic. [IPython magic](https://ipython.readthedocs.io/en/stable/interactive/magics.html) is a special command that can be used in the IPython shell to perform specific tasks before executing the code. Since Jupyter includes the IPython shell, you can also use these magic commands in Jupyter Notebook.\n\nIPython magic commands are prefixed with % or %% and % applies the magic to a single line of code, while %% applies the magic to multiple lines of code.\n\n## Installation\n\nTo install thanosql-magic, you can use pip:\n\n```\npip install thanosql-magic\n```\n\nOnce installed, you can load the extension in your Jupyter notebook by running:\n\n```python\n%load_ext thanosql\n```\n\n## Usage\n\nAfter loading the extension, you can connect to your ThanoSQL Engine instance by setting the thanosql variable:\n\n1. Setting API_TOKEN\n\n   ```python\n   %thanosql API_TOKEN=<Issued_API_TOKEN>\n   ```\n\n1. Changing the Default API URI (Optional)\n\n   ```python\n   %thanosql http://localhost:8000/api/v1/query\n   ```\n\n3. Using Magic Commands\n\n   You can then execute SQL queries on your Thanos data using the %thanosql magic command:\n\n   ```python\n   %%thanosql\n   SELECT * FROM users\n   ```\n\n   This will run the SQL query and display the results in your Jupyter notebook.\n\nYou can also refer to the guide provided in [ThanoSQL's official documentation](https://docs.thanosql.ai/getting_started/hello_ThanoSQL/#3-check-the-list-of-the-thanosql-models-and-datasets-using-the-list-query-syntax).\n\n## Requirements\n- Python 3.x\n- Jupyter Notebook\n\n## Contributing\nIf you find any issues or would like to contribute to thanosql-magic, feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/smartmind-team/thanosql-magic).\n\n## License\n\n[MIT](LICENSE)\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "ThanoSQL Magic",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/smartmind-team/thanosql-magic"
    },
    "split_keywords": [
        "smartmind",
        "thanosql",
        "ipython",
        "jupyter"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c884a1552b713e599bb006329c0b8d7da5ff9ebbc38368c39bbd4bdbbffefef",
                "md5": "bf2ac618c8584f92df7be0d472e4426e",
                "sha256": "640b5aa3d3bdd00a07edcdf3136009683e625bf811133354bd4dd92faf83bacb"
            },
            "downloads": -1,
            "filename": "thanosql_magic-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bf2ac618c8584f92df7be0d472e4426e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6963,
            "upload_time": "2024-03-22T04:52:41",
            "upload_time_iso_8601": "2024-03-22T04:52:41.500164Z",
            "url": "https://files.pythonhosted.org/packages/9c/88/4a1552b713e599bb006329c0b8d7da5ff9ebbc38368c39bbd4bdbbffefef/thanosql_magic-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0dd8a32b4cdea2b9265277baf564dcf6c1f953afb7e478cc588f352a1371eccc",
                "md5": "afe3585f9edf3c29e718582829282050",
                "sha256": "5f68e2385d41f442fc0060deba72126af500af6fcdb13684f2b9384cc1a3a9b0"
            },
            "downloads": -1,
            "filename": "thanosql-magic-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "afe3585f9edf3c29e718582829282050",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6199,
            "upload_time": "2024-03-22T04:52:43",
            "upload_time_iso_8601": "2024-03-22T04:52:43.170775Z",
            "url": "https://files.pythonhosted.org/packages/0d/d8/a32b4cdea2b9265277baf564dcf6c1f953afb7e478cc588f352a1371eccc/thanosql-magic-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 04:52:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "smartmind-team",
    "github_project": "thanosql-magic",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "thanosql-magic"
}
        
Elapsed time: 0.21652s