{ "info": { "author": "Man AHL Technology", "author_email": "ManAHLTech@ahl.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: SQL", "Topic :: Database", "Topic :: Database :: Front-Ends", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# okcli\n[![Build status](https://circleci.com/gh/manahl/okcli.svg?style=svg)](https://circleci.com/gh/manahl/okcli)\n[![PyPi python version](https://img.shields.io/pypi/pyversions/okcli.svg)](https://pypi.org/project/okcli/)\n[![PyPi project version](https://img.shields.io/pypi/v/okcli.svg)](https://pypi.org/project/okcli/)\n\n\nMan Okcli for Oracle Database.\n\nAn Oracle-DB command line client with auto-completion and syntax highlighting that emulates the functionality of [sqlplus](http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html).\n\n### index\n* [install](#install)\n* [user guide](#user-guide)\n* [usage](#usage)\n* [faq](#faq)\n\n\n# install\nInstall ``okcli`` from [pypi](https://pypi.org/) with [pip](https://pypi.org/project/pip/).\n\n```\n> sudo pip install okcli\n```\n\nor without sudo credentials\n\n```\n> pip install --user okcli\n```\n\n# documentation\nFor documentation and config options see the [user guide](#user-guide) or type ``help`` from within the app.\n\n# demo \n![demo](docs/example.gif)\n\n\n# usage\n```\nUsage: okcli [OPTIONS] [SQLPLUS]\n\n An Oracle-DB terminal client with auto-completion and syntax highlighting.\n\n Examples:\n - okcli -u my_user -h my_host.com -D schema\n - okcli user/password@tns_name \n - okcli user/password@tns_name -D schema \n - okcli user/password@tns_name -e \"query\"\n - okcli user@tns_name -@ query_file.sql\n\nOptions:\n -h, --host TEXT Host address of the database.\n -P, --port INTEGER Port number to use for connection.\n -u, --user TEXT User name to connect to the database.\n -p, --password TEXT Password to connect to the database.\n -v, --version Output okcli's version.\n -D, --database TEXT Database to use.\n -R, --prompt TEXT Prompt format (Default: \"\\t \\u@\\h:\\d> \").\n -l, --logfile FILENAME Log every query and its results to a file.\n --okclirc PATH Location of okclirc file.\n --auto-vertical-output Automatically switch to vertical output mode if the\n result is wider than the terminal width.\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 --login-path TEXT Read this path from the login file.\n -e, --execute TEXT Execute command and quit.\n -@, --filename TEXT Execute commands in a file.\n --help Show this message and exit.\n```\n\n\n\n\n# user-guide\n* [display help text](#help)\n* [app config](#config)\n* [set colour scheme](#colours)\n* [execute host shell commands](#shell)\n* [execute commands from file](#exec-file)\n* [describe](#describe)\n* [stored procedures](#stored-procs)\n* [favourite commands](#favourite-commands)\n* [escape to an editor to finish writing an SQL statement](#edit)\n* [change output format](#format)\n* [list all schemas in database](#list)\n* [list all tables in a schema](#show)\n* [spool (append) query output to a file](#spool)\n* [exit the app](#exit)\n\n\n# help\nThe ``help`` command displays help text for all other commands.\n\n# config\nThe file ``~/.okclirc`` is created upon installation with config for okcli.\n\nThings like colour-scheme, prompt-format, log-file location etc. can be updated there.\n\n# colours\n\nThe ``syntax_style`` parameter in the [config-file](#config) sets the syntax colour scheme, select from the following:\n\n```\n# Syntax coloring style. Possible values (many support the \"-dark\" suffix):\n# manni, igor, xcode, vim, autumn, vs, rrt, native, perldoc, borland, tango, emacs,\n# friendly, monokai, paraiso, colorful, murphy, bw, pastie, paraiso, trac, default,\n# fruity.\n```\n\nOther style options (eg. the status bar) can also be set in the [config-file](#config).\n\n# shell\nStart a statement with ``! `` to execute it as a shell command.\n\nFor example\n```\nOracle-18c oracle@system:hr> ! echo Hello Okcli\nHello Okcli\n```\n\n# exec-file\nExecute sql statements from a file by passing it as an argument with ``-@``.\n\nFor example:\n```\n > cat date_query.sql \nselect sysdate from dual\n > okcli hr@xe:HR -@date_query.sql\nSYSDATE\n2019-03-12 16:42:34\n```\n\n# describe \nThe ``describe`` command will show for a given table or view:\n* each column, its datatype, if it's nullable\n* primary-key constraints (if it's a table)\n* foreign-key constraints (if it's a view)\n* the SQL query used to create the view (if it's a view)\n\nFor example:\n```\nOracle-11g hr@xe:HR> desc HR.EMPLOYEES\n+----------------+-----------+-------------+----------+\n| COLUMN_NAME | DATA_TYPE | DATA_LENGTH | NULLABLE |\n+----------------+-----------+-------------+----------+\n| EMPLOYEE_ID | NUMBER | 22 | N |\n| FIRST_NAME | VARCHAR2 | 20 | Y |\n| LAST_NAME | VARCHAR2 | 25 | N |\n| EMAIL | VARCHAR2 | 25 | N |\n| PHONE_NUMBER | VARCHAR2 | 20 | Y |\n| HIRE_DATE | DATE | 7 | N |\n| JOB_ID | VARCHAR2 | 10 | N |\n| SALARY | NUMBER | 22 | Y |\n| COMMISSION_PCT | NUMBER | 22 | Y |\n| MANAGER_ID | NUMBER | 22 | Y |\n| DEPARTMENT_ID | NUMBER | 22 | Y |\n+----------------+-----------+-------------+----------+\nTime: 0.098s\n\n+---------------------+\n| PRIMARY_KEY_COLUMNS |\n+---------------------+\n| EMPLOYEE_ID |\n+---------------------+\nTime: 0.370s\n\n+---------------+---------------------------+\n| COLUMN_NAME | FOREIGN_KEY_CONSTRAINT |\n+---------------+---------------------------+\n| DEPARTMENT_ID | DEPARTMENTS.DEPARTMENT_ID |\n| JOB_ID | JOBS.JOB_ID |\n| MANAGER_ID | EMPLOYEES.EMPLOYEE_ID |\n+---------------+---------------------------+\nTime: 2.228s\n```\n# stored-procedures\nStored-procedures can be run with the ``exec`` command. \n\nFor example\n```\nOracle-11g hr@xe:HR> exec some_schema.my_procedure(arg1, 'arg2')\n```\n\n# favourite-commands\nThe ``\\fs [name]`` command will save the current statement with a name.\n\nThe ``\\f [name]`` command will load the statement with that name or list all the saved statements if no name is given.\n\nThe ``\\fd [name]`` command will delete the saved statement.\n\nFor example\n```\nOracle-11g hr@xe:HR> \\fs depts select * from HR.DEPARTMENTS where MANAGER_ID > 200 \nSaved. \nTime: 0.003s \nOracle-11g hr@xe:HR> \\f depts \n> select * from HR.DEPARTMENTS where MANAGER_ID > 200 \n+---------------+------------------+------------+-------------+\n| DEPARTMENT_ID | DEPARTMENT_NAME | MANAGER_ID | LOCATION_ID |\n+---------------+------------------+------------+-------------+\n| 20 | Marketing | 201 | 1800 |\n| 40 | Human Resources | 203 | 2400 |\n| 70 | Public Relations | 204 | 2700 |\n| 110 | Accounting | 205 | 1700 |\n+---------------+------------------+------------+-------------+\n4 row s in set\nTime: 0.002s\nOracle-11g hr@xe:HR> \\f\n+-------+------------------------------------------------------+\n| Name | Query |\n+-------+------------------------------------------------------+\n| depts | select * from HR.DEPARTMENTS where MANAGER_ID > 200 |\n+-------+------------------------------------------------------+\nTime: 0.001s\n\nNo favorite query:\nTime: 0.000s\nOracle-11g hr@xe:HR> \\fs depts_2 select * from HR.DEPARTMENTS where MANAGER_ID < 200\nSaved.\nTime: 0.001s\nOracle-11g hr@xe:HR> \\f\n+---------+------------------------------------------------------+\n| Name | Query |\n+---------+------------------------------------------------------+\n| depts | select * from HR.DEPARTMENTS where MANAGER_ID > 200 |\n| depts_2 | select * from HR.DEPARTMENTS where MANAGER_ID < 200 |\n+---------+------------------------------------------------------+\nTime: 0.001s\n\n\n```\n\n# edit\nWhen writing a statement you can escape to your favourite editor (set by ``$EDITOR``) by adding ``ed`` to the start of the query. \n\nWhen you save and exit the file it will take you back to the CLI with the statement that you finished editing in the file.\n\nFor example:\n```\nOracle-11g hr@xe:HR> ed select * from\n```\n\n# format\nThe ``format`` command sets the format of the query-output (if there is any).\n\nThe supported output formats are:\n```\n jira \n latex \n github \n latex_booktabs \n vertical \n simple \n plain \n psql \n pipe \n moinmoin \n orgtbl \n textile \n mediawiki \n html \n grid \n double \n tsv \n ascii\n csv\n fancy_grid\n rst\n```\n\nFor example:\n```\nOracle-11g hr@xe:HR> format fancy_grid\nChanged table format to fancy_grid\nTime: 0.000s\nOracle-11g hr@xe:HR> select * from hr.DEPARTMENTS where MANAGER_ID >200\n\u2552\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2555\n\u2502 DEPARTMENT_ID \u2502 DEPARTMENT_NAME \u2502 MANAGER_ID \u2502 LOCATION_ID \u2502\n\u255e\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u256a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2561\n\u2502 20 \u2502 Marketing \u2502 201 \u2502 1800 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 40 \u2502 Human Resources \u2502 203 \u2502 2400 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 70 \u2502 Public Relations \u2502 204 \u2502 2700 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 110 \u2502 Accounting \u2502 205 \u2502 1700 \u2502\n\u2558\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255b\n4 row s in set\nTime: 0.003s\nOracle-11g hr@xe:HR> format csv\nChanged table format to csv\nTime: 0.000s\nOracle-11g hr@xe:HR> select * from hr.DEPARTMENTS where MANAGER_ID >200\nDEPARTMENT_ID,DEPARTMENT_NAME,MANAGER_ID,LOCATION_ID\n20,Marketing,201,1800\n40,Human Resources,203,2400\n70,Public Relations,204,2700\n110,Accounting,205,1700\n\n4 row s in set\nTime: 0.002s\n```\n\n# list\nThe ``list`` command shows all the schemas available.\n\nFor example\n```\nOracle-11g hr@xe:HR> list\n+-------------+\n| OWNER |\n+-------------+\n| MDSYS |\n| CTXSYS |\n| HR |\n| SYSTEM |\n| APEX_040000 |\n| XDB |\n| SYS |\n+-------------+\n```\n\n# show\nThe ``show`` command shows all the tables in a schema.\n\nFor example\n```\nOracle-11g hr@xe:HR> show HR\n+------------------+\n| TABLE_NAME |\n+------------------+\n| LOCATIONS |\n| EMPLOYEES |\n| EMP_DETAILS_VIEW |\n| REGIONS |\n| JOBS |\n| COUNTRIES |\n| JOB_HISTORY |\n| DEPARTMENTS |\n+------------------+\n```\n# spool\nThe ``spool`` command will append the output of subsequent statements to a file. \n\n``nospool`` will stop appending the output to the file.\n\n``once`` spools the output for only the next command.\n\nFor example:\n```\nOracle-11g hr@xe:HR> spool output.txt\nTime: 0.001s\nOracle-11g hr@xe:HR> select * from hr.DEPARTMENTS where MANAGER_ID > 200\n+---------------+------------------+------------+-------------+\n| DEPARTMENT_ID | DEPARTMENT_NAME | MANAGER_ID | LOCATION_ID |\n+---------------+------------------+------------+-------------+\n| 20 | Marketing | 201 | 1800 |\n| 40 | Human Resources | 203 | 2400 |\n| 70 | Public Relations | 204 | 2700 |\n| 110 | Accounting | 205 | 1700 |\n+---------------+------------------+------------+-------------+\n4 row s in set\nTime: 0.003s\nOracle-11g hr@xe:HR> exit\nroot@b809269946dd:/# cat output.txt \nOracle-11g hr@xe:HR> select * from hr.DEPARTMENTS where MANAGER_ID > 200\n+---------------+------------------+------------+-------------+\n| DEPARTMENT_ID | DEPARTMENT_NAME | MANAGER_ID | LOCATION_ID |\n+---------------+------------------+------------+-------------+\n| 20 | Marketing | 201 | 1800 |\n| 40 | Human Resources | 203 | 2400 |\n| 70 | Public Relations | 204 | 2700 |\n| 110 | Accounting | 205 | 1700 |\n+---------------+------------------+------------+-------------+\n```\n\n\n# exit\nExit the CLI app with ``exit``, ``quit`` or ``\\q``.\n\n# faq\n\n### DPI-1047: Cannot locate a 64-bit Oracle Client library: \"libclntsh.so: cannot open shared object file: No such file or directory\". See https://oracle.github.io/odpi/doc/installation.html#linux for help\n \nIf you see this error message make sure that the ``$ORACLE_HOME/lib`` is on ``$LD_LIBRARY_PATH``. This is needed by cx-oracle to make the database connection. As a sanity check ``ls $ORACLE_HOME/lib`` should list the oracle libraries.\n\nUpdate the library-path with:\n\n```\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib\n```\n\n### windows support\nIn principle ``okcli`` should work on Windows but it has only been tested on Linux. If you're interested in testing on Windows please raise an issue.\n\n# thanks\nThanks to [mycli](https://github.com/dbcli/mycli). Most of the features (e.g. syntax highlighting, auto-complete) were implemented by the mycli core team for MySQL.", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/manahl/okcli", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "okcli", "package_url": "https://pypi.org/project/okcli/", "platform": "", "project_url": "https://pypi.org/project/okcli/", "project_urls": { "Homepage": "https://github.com/manahl/okcli" }, "release_url": "https://pypi.org/project/okcli/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "A CLI for Oracle DB Database with auto-completion and syntax highlighting.", "version": "1.0.5" }, "last_serial": 5372866, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "4e453579e30fb5d46bd1d3df14933c9e", "sha256": "821d75fed007474572904b58052644af0cc90b0b3894af14a4bff30df0c156b5" }, "downloads": -1, "filename": "okcli-1.0.0.tar.gz", "has_sig": false, "md5_digest": "4e453579e30fb5d46bd1d3df14933c9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49106, "upload_time": "2019-05-13T12:51:05", "url": "https://files.pythonhosted.org/packages/b9/c4/7d9ded2cb24d1294c872e20a31da3c815d7b1702ae138d3ebaece7b8a512/okcli-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "7e7293b7ef79cfabb35d6d709d4577f6", "sha256": "d3c205ac02fbcc8b19e23864ab89d31d268ff3a98c074212e8cfeb1a4e4e8f35" }, "downloads": -1, "filename": "okcli-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7e7293b7ef79cfabb35d6d709d4577f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57258, "upload_time": "2019-05-13T12:57:58", "url": "https://files.pythonhosted.org/packages/f7/2a/a13a82c82ecbd15b0549c83a4545538c653500583738024747cd4bab4851/okcli-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "11f178bc903e2931df953fe1b5d160f5", "sha256": "dca358374584d3428323de2e1719679eb412cc08a9b528e2ee2753d269e0f59c" }, "downloads": -1, "filename": "okcli-1.0.2.tar.gz", "has_sig": false, "md5_digest": "11f178bc903e2931df953fe1b5d160f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57254, "upload_time": "2019-05-13T13:01:14", "url": "https://files.pythonhosted.org/packages/88/dd/e5a0f72d587217ebca86a44b4ff51ff4e04d5c13bbc117913cd78dab9d8b/okcli-1.0.2.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "6e58725494e9d610fe49f63c81b27e8c", "sha256": "d7a14b0eaceb9ce2da71eaba68bd615d9c4232d1c965e8d3f264ce8c25abbdc9" }, "downloads": -1, "filename": "okcli-1.0.4.tar.gz", "has_sig": false, "md5_digest": "6e58725494e9d610fe49f63c81b27e8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 751417, "upload_time": "2019-05-21T16:12:06", "url": "https://files.pythonhosted.org/packages/e6/e7/ef345822c95c3beca81c977322589a071ed6904c5521e2bbc8143d7f2be2/okcli-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "683f27d1fc1399d5b430b176c19ac135", "sha256": "2fe24e8e4b1ad1a40a8bf40b55995f8482ef8910edd016ee940b0764a52cf397" }, "downloads": -1, "filename": "okcli-1.0.5.tar.gz", "has_sig": false, "md5_digest": "683f27d1fc1399d5b430b176c19ac135", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57579, "upload_time": "2019-06-07T19:33:23", "url": "https://files.pythonhosted.org/packages/4b/ac/e5f9b3b70430b43ff08194d8b10efb02b7b7dc38dc249672613067e0fbb5/okcli-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "683f27d1fc1399d5b430b176c19ac135", "sha256": "2fe24e8e4b1ad1a40a8bf40b55995f8482ef8910edd016ee940b0764a52cf397" }, "downloads": -1, "filename": "okcli-1.0.5.tar.gz", "has_sig": false, "md5_digest": "683f27d1fc1399d5b430b176c19ac135", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57579, "upload_time": "2019-06-07T19:33:23", "url": "https://files.pythonhosted.org/packages/4b/ac/e5f9b3b70430b43ff08194d8b10efb02b7b7dc38dc249672613067e0fbb5/okcli-1.0.5.tar.gz" } ] }