Name | irissqlcli JSON |
Version |
0.5.4
JSON |
| download |
home_page | https://github.com/caretdev/irissqlcli |
Summary | CLI for SQL of InterSystems IRIS Databases with auto-completion and syntax highlighting. |
upload_time | 2023-04-12 09:32:48 |
maintainer | |
docs_url | None |
author | CaretDev |
requires_python | >=3.7 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
A REPL for InterSystems IRIS SQL
===
This is a InterSystems IRIS client that does auto-completion and syntax highlighting.
Based on [pgcli](https://github.com/dbcli/pgcli)
![irissqlcli](https://raw.githubusercontent.com/caretdev/irissqlcli/main/screenshots/irissqlcli.png)
Quick Start
==
With Python
```shell
pip install -U irissqlcli
```
Or with homebrew
```shell
brew tap caretdev/tap
brew install irissqlcli
```
Usage
-----
$ irissqlcli [uri]
or
$ irissqlcli iris://[user[:password]@][netloc][:port][/namespace]
or
$ irissqlcli iris+emb://[/namespace]
Examples:
$ irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER
$ irissqlcli iris+emb:///
For more details:
$ irissqlcli --help
Usage: irissqlcli [OPTIONS] [URI] [USERNAME]
Options:
-h, --host TEXT Host address of the IRIS instance.
-p, --port INTEGER Port number at which the IRIS instance is listening.
-U, --username TEXT Username to connect to the IRIS instance.
-u, --user TEXT Username to connect to the IRIS instance.
-W, --password Force password prompt.
-v, --version Version of irissqlcli.
-n, --nspace TEXT namespace name to connect to.
-q, --quiet Quiet mode, skip intro on startup and goodbye on
exit.
-l, --logfile FILENAME Log every query and its results to a file.
--irissqlclirc FILE Location of irissqlclirc file.
--auto-vertical-output Automatically switch to vertical output mode if the
result is wider than the terminal width.
--row-limit INTEGER Set threshold for row limit prompt. Use 0 to disable
prompt.
-t, --table Display batch output in table format.
--csv Display batch output in CSV format.
--warn / --no-warn Warn before running a destructive query.
-e, --execute TEXT Execute command and quit.
--help Show this message and exit.
``irissqlcli`` also supports `environment variables` for login options (e.g. ``IRIS_HOSTNAME``, ``IRIS_PORT``, ``IRIS_NAMESPACE``, ``IRIS_USERNAME``, ``IRIS_PASSWORD``).
Features
--------
The `irissqlcli` is written using prompt_toolkit_.
* Auto-completes as you type for SQL keywords as well as tables and
columns in the database.
* Syntax highlighting using Pygments.
* Smart-completion (enabled by default) will suggest context-sensitive
completion.
- ``SELECT * FROM <tab>`` will only show table names.
- ``SELECT * FROM users WHERE <tab>`` will only show column names.
* Pretty prints tabular data.
Config
------
A config file is automatically created at ``~/.config/irissqlcli/config`` at first launch.
See the file itself for a description of all available options.
Docker
======
irisqlcli can be run from within Docker. This can be useful to try irissqlcli without
installing it, or any dependencies, system-wide.
To create a container from the image:
$ docker run --rm -ti caretdev/irissqlcli irissqlcli <ARGS>
To access InterSystems IRIS databases listening on localhost, make sure to run the
docker in "host net mode". E.g. to access a database called "foo" on the
IRIS server running on localhost:1972 (the standard port):
$ docker run --rm -ti --net host caretdev/irissqlcli irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER
or without `host net mode`
$ docker run --rm -ti caretdev/irissqlcli irissqlcli iris://_SYSTEM:SYS@host.docker.internal:1972/USER
IPython
=======
irisqlcli can be run from within [IPython](https://ipython.org) console. When working on a query,
it may be useful to drop into a irissqlcli session without leaving the IPython console, iterate on a
query, then quit irissqlcli to find the query results in your IPython workspace.
Assuming you have IPython installed:
$ pip install sqlalchemy~=1.4.0 ipython-sql sqlalchemy-iris
After that, run ipython and load the ``irissqlcli.magic`` extension:
$ ipython
In [1]: %load_ext irissqlcli.magic
or
$ ipython --ext irissqlcli.magic
Connect to a database:
In [2]: %irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER
self.dialect <class 'sqlalchemy_iris.iris.IRISDialect_iris'>
sqlalchemy.MetaData <class 'sqlalchemy.sql.schema.MetaData'>
Server: InterSystems IRIS Version 2022.2.0.368 xDBC Protocol Version 65
Version: 0.1.0
[SQL]_SYSTEM@localhost:USER> select top 10 table_schema,table_name from information_schema.tables
+--------------------+----------------+
| TABLE_SCHEMA | TABLE_NAME |
+--------------------+----------------+
| %CSP_Util | CSPLogEvent |
| %CSP_Util | Performance |
| %Calendar | Hijri |
| %Compiler_Informix | ConversionRule |
| %Compiler_Informix | ImportedObject |
| %Compiler_Informix | Symbol |
| %Compiler_LG | WrapperPropDef |
| %Compiler_TSQL | sysSymbol |
| %DeepSee | IDList |
| %DeepSee | TempSourceId |
+--------------------+----------------+
10 rows in set
Time: 0.074s
[SQL]_SYSTEM@localhost:USER>
Exit out of irissqlcli session with ``Ctrl + D`` and find the query results:
[SQL]_SYSTEM@localhost:USER>
Goodbye!
Done.
Out[2]:
[('%DocDB', 'Database'),
('%ExtentMgr', 'GUID'),
('%ExtentMgr', 'GlobalRegistry'),
('%ExtentMgr_Catalog', 'Extent'),
('%ExtentMgr_Catalog', 'Index'),
('%ExtentMgr_Catalog', 'Property'),
('%ExtentMgr_Catalog', 'ShardIdRanges'),
('%SYS_Maint', 'Bitmap'),
('%SYS_Maint', 'BitmapResults'),
('%SYS_Maint', 'Bitmap_Message')]
The results are available in special local variable ``_``, and can be assigned to a variable of your
choice:
In [3]: my_result = _
Raw data
{
"_id": null,
"home_page": "https://github.com/caretdev/irissqlcli",
"name": "irissqlcli",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "CaretDev",
"author_email": "irissqlcli@caretdev.com",
"download_url": "https://files.pythonhosted.org/packages/5a/d3/4d261cdcaa4dc253bbd6d00405b6c1f455fd7f7902a63b1b02cd58a2dc31/irissqlcli-0.5.4.tar.gz",
"platform": null,
"description": "A REPL for InterSystems IRIS SQL\n===\n\nThis is a InterSystems IRIS client that does auto-completion and syntax highlighting.\n\nBased on [pgcli](https://github.com/dbcli/pgcli)\n\n![irissqlcli](https://raw.githubusercontent.com/caretdev/irissqlcli/main/screenshots/irissqlcli.png)\n\nQuick Start\n==\n\nWith Python\n\n```shell\npip install -U irissqlcli\n```\n\nOr with homebrew\n\n```shell\nbrew tap caretdev/tap\nbrew install irissqlcli\n```\n\nUsage\n-----\n\n $ irissqlcli [uri]\n\n or\n\n $ irissqlcli iris://[user[:password]@][netloc][:port][/namespace]\n\n or\n\n $ irissqlcli iris+emb://[/namespace]\n\nExamples:\n\n $ irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER\n\n $ irissqlcli iris+emb:///\n\nFor more details:\n\n $ irissqlcli --help\n Usage: irissqlcli [OPTIONS] [URI] [USERNAME]\n\n Options:\n -h, --host TEXT Host address of the IRIS instance.\n -p, --port INTEGER Port number at which the IRIS instance is listening.\n -U, --username TEXT Username to connect to the IRIS instance.\n -u, --user TEXT Username to connect to the IRIS instance.\n -W, --password Force password prompt.\n -v, --version Version of irissqlcli.\n -n, --nspace TEXT namespace name to connect to.\n -q, --quiet Quiet mode, skip intro on startup and goodbye on\n exit.\n -l, --logfile FILENAME Log every query and its results to a file.\n --irissqlclirc FILE Location of irissqlclirc file.\n --auto-vertical-output Automatically switch to vertical output mode if the\n result is wider than the terminal width.\n --row-limit INTEGER Set threshold for row limit prompt. Use 0 to disable\n prompt.\n -t, --table Display batch output in table format.\n --csv Display batch output in CSV format.\n --warn / --no-warn Warn before running a destructive query.\n -e, --execute TEXT Execute command and quit.\n --help Show this message and exit.\n\n``irissqlcli`` also supports `environment variables` for login options (e.g. ``IRIS_HOSTNAME``, ``IRIS_PORT``, ``IRIS_NAMESPACE``, ``IRIS_USERNAME``, ``IRIS_PASSWORD``).\n\nFeatures\n--------\n\nThe `irissqlcli` is written using prompt_toolkit_.\n\n* Auto-completes as you type for SQL keywords as well as tables and\n columns in the database.\n* Syntax highlighting using Pygments.\n* Smart-completion (enabled by default) will suggest context-sensitive\n completion.\n\n - ``SELECT * FROM <tab>`` will only show table names.\n - ``SELECT * FROM users WHERE <tab>`` will only show column names.\n\n* Pretty prints tabular data.\n\nConfig\n------\nA config file is automatically created at ``~/.config/irissqlcli/config`` at first launch.\nSee the file itself for a description of all available options.\n\nDocker\n======\n\nirisqlcli can be run from within Docker. This can be useful to try irissqlcli without\ninstalling it, or any dependencies, system-wide.\n\nTo create a container from the image:\n\n $ docker run --rm -ti caretdev/irissqlcli irissqlcli <ARGS>\n\nTo access InterSystems IRIS databases listening on localhost, make sure to run the\ndocker in \"host net mode\". E.g. to access a database called \"foo\" on the\nIRIS server running on localhost:1972 (the standard port):\n\n $ docker run --rm -ti --net host caretdev/irissqlcli irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER\n\n or without `host net mode`\n\n $ docker run --rm -ti caretdev/irissqlcli irissqlcli iris://_SYSTEM:SYS@host.docker.internal:1972/USER\n\nIPython\n=======\n\nirisqlcli can be run from within [IPython](https://ipython.org) console. When working on a query,\nit may be useful to drop into a irissqlcli session without leaving the IPython console, iterate on a\nquery, then quit irissqlcli to find the query results in your IPython workspace.\n\nAssuming you have IPython installed:\n\n $ pip install sqlalchemy~=1.4.0 ipython-sql sqlalchemy-iris\n\nAfter that, run ipython and load the ``irissqlcli.magic`` extension:\n\n\n $ ipython\n\n In [1]: %load_ext irissqlcli.magic\n\n or \n $ ipython --ext irissqlcli.magic\n\nConnect to a database:\n\n In [2]: %irissqlcli iris://_SYSTEM:SYS@localhost:1972/USER\n self.dialect <class 'sqlalchemy_iris.iris.IRISDialect_iris'>\n sqlalchemy.MetaData <class 'sqlalchemy.sql.schema.MetaData'>\n Server: InterSystems IRIS Version 2022.2.0.368 xDBC Protocol Version 65\n Version: 0.1.0\n [SQL]_SYSTEM@localhost:USER> select top 10 table_schema,table_name from information_schema.tables\n +--------------------+----------------+\n | TABLE_SCHEMA | TABLE_NAME |\n +--------------------+----------------+\n | %CSP_Util | CSPLogEvent |\n | %CSP_Util | Performance |\n | %Calendar | Hijri |\n | %Compiler_Informix | ConversionRule |\n | %Compiler_Informix | ImportedObject |\n | %Compiler_Informix | Symbol |\n | %Compiler_LG | WrapperPropDef |\n | %Compiler_TSQL | sysSymbol |\n | %DeepSee | IDList |\n | %DeepSee | TempSourceId |\n +--------------------+----------------+\n 10 rows in set\n Time: 0.074s\n [SQL]_SYSTEM@localhost:USER>\n\nExit out of irissqlcli session with ``Ctrl + D`` and find the query results:\n\n [SQL]_SYSTEM@localhost:USER> \n Goodbye!\n Done.\n Out[2]: \n [('%DocDB', 'Database'),\n ('%ExtentMgr', 'GUID'),\n ('%ExtentMgr', 'GlobalRegistry'),\n ('%ExtentMgr_Catalog', 'Extent'),\n ('%ExtentMgr_Catalog', 'Index'),\n ('%ExtentMgr_Catalog', 'Property'),\n ('%ExtentMgr_Catalog', 'ShardIdRanges'),\n ('%SYS_Maint', 'Bitmap'),\n ('%SYS_Maint', 'BitmapResults'),\n ('%SYS_Maint', 'Bitmap_Message')]\n\nThe results are available in special local variable ``_``, and can be assigned to a variable of your\nchoice:\n\n In [3]: my_result = _\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "CLI for SQL of InterSystems IRIS Databases with auto-completion and syntax highlighting.",
"version": "0.5.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cd1a16f0d6b2fe42848fa9156ebb8c3b9079bed0083bfa2de24185d2f8285511",
"md5": "721238d89fcee83dd5dbd6a69c9094df",
"sha256": "8432a3c1852d61e9b7e8ab7793f8aa257071b6b70d30ff44e3f6c73bd08ccd60"
},
"downloads": -1,
"filename": "irissqlcli-0.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "721238d89fcee83dd5dbd6a69c9094df",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 161762,
"upload_time": "2023-04-12T09:32:46",
"upload_time_iso_8601": "2023-04-12T09:32:46.504603Z",
"url": "https://files.pythonhosted.org/packages/cd/1a/16f0d6b2fe42848fa9156ebb8c3b9079bed0083bfa2de24185d2f8285511/irissqlcli-0.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ad34d261cdcaa4dc253bbd6d00405b6c1f455fd7f7902a63b1b02cd58a2dc31",
"md5": "879d30a527a5756230d150eee4839755",
"sha256": "40470b6100954ee15ade459bcbbeb0d6014b6750a8573c8549486687d45b568b"
},
"downloads": -1,
"filename": "irissqlcli-0.5.4.tar.gz",
"has_sig": false,
"md5_digest": "879d30a527a5756230d150eee4839755",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 135124,
"upload_time": "2023-04-12T09:32:48",
"upload_time_iso_8601": "2023-04-12T09:32:48.249608Z",
"url": "https://files.pythonhosted.org/packages/5a/d3/4d261cdcaa4dc253bbd6d00405b6c1f455fd7f7902a63b1b02cd58a2dc31/irissqlcli-0.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-12 09:32:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "caretdev",
"github_project": "irissqlcli",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "irissqlcli"
}