Skip to main content

ThanoSQL Magic

Project description

# 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 `

  1. 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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thanosql-magic-0.3.9.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thanosql_magic-0.3.9-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file thanosql-magic-0.3.9.tar.gz.

File metadata

  • Download URL: thanosql-magic-0.3.9.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for thanosql-magic-0.3.9.tar.gz
Algorithm Hash digest
SHA256 c7e622cced34f7d29a10e82d848e68855e47a4a09e1ca9b4d7b637c7a9ee5d80
MD5 d287a5472b5dfc84f3861889425e3129
BLAKE2b-256 d4ed0ce9af3f38d2f44e676c132a55b9c82d6780aa2c1d0fa6e647fb95a73d46

See more details on using hashes here.

File details

Details for the file thanosql_magic-0.3.9-py3-none-any.whl.

File metadata

  • Download URL: thanosql_magic-0.3.9-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for thanosql_magic-0.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5790ef107046ff89b6817c12ab07f9a363488e08e6e87cd5a25c80e4872f79a2
MD5 0339ab4cfedcce10ec34460ec7df1969
BLAKE2b-256 af0da5bc6d110d3b722e6cb7f68e7c70167f5d6caf94713d86de23c9dc528a34

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page