{ "info": { "author": "Josue Kouka", "author_email": "josuebrunel@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "MYQL-CLI\r\n~~~~~~~~\r\n\r\n`|Build Status| `_\r\n`|Documentation Status| `_\r\n\r\n***MYQL-cli*** is a command line tool to run YQL queries or to generate\r\nYQL OpenTable.\r\n\r\nInstallation\r\n^^^^^^^^^^^^\r\n\r\n::\r\n\r\n $ pip install myql-cli # Not available yet\r\n\r\nHow To\r\n^^^^^^\r\n\r\n::\r\n\r\n usage: YQL-cli tools [-h] [-v] {init-config,execute,shell,table} ...\r\n\r\n positional arguments:\r\n {init-config,execute,shell,table}\r\n commands\r\n init-config Init a config file .myql-cli.ini in your home\r\n directory\r\n execute Executes a YQL query\r\n shell Prompts a YQL shell command\r\n table Creates a YQL table\r\n\r\n optional arguments:\r\n -h, --help show this help message and exit\r\n -v, --version show program's version number and exit\r\n\r\nConfig File\r\n'''''''''''\r\n\r\n***myql-cli*** config file is located in ***~/.myql-cli.ini***.\r\n\r\n::\r\n\r\n $ ./myql-cli.py init-config\r\n\r\n::\r\n\r\n [DEFAULT]\r\n format = json # Default format\r\n oauth = False # OAuth enabled\r\n\r\n [json] \r\n diagnostics = False\r\n debug = False\r\n jsoncompact = False\r\n\r\n [xml]\r\n diagnostics = False\r\n debug = False\r\n\r\n [auth]\r\n from_file = None # Path to your credentials json file\r\n\r\n**NB**: Your ***credentials*** file must at least have\r\n\r\n::\r\n\r\n {\r\n \"consumer_key\":\"your consumenr key\",\r\n \"consumer_secret\": \"your consumer secret\"\r\n }\r\n\r\nQuery Tool\r\n''''''''''\r\n\r\n::\r\n\r\n $ myql-cli execute -h\r\n usage: YQL-cli tools execute [-h] [--format {json,xml}] [--pretty]\r\n [--jsonCompact] [--diagnostics] [--debug]\r\n execute\r\n\r\n positional arguments:\r\n execute Execute a YQL query\r\n\r\n optional arguments:\r\n -h, --help show this help message and exit\r\n --format {json,xml} Response returned format\r\n --jsonCompact Json response compacted\r\n --diagnostics Response with diagnostics\r\n --debug Response with diagnostics\r\n\r\n- ***json***\r\n\r\n``shell $ myql-cli execute --format json \"select * from geo.countries where name='Congo'\"``\r\n``json { \"query\": { \"count\": 1, \"lang\": \"en-US\", \"results\": { \"place\": { \"lang\": \"en-US\", \"woeid\": \"23424779\", \"uri\": \"http://where.yahooapis.com/v1/place/23424779\", \"name\": \"Congo\", \"placeTypeName\": { \"content\": \"Country\", \"code\": \"12\" } } }, \"created\": \"2015-04-07T12:37:13Z\" } }``\r\n\r\n- ***xml***\r\n\r\n``shell $ myql-cli execute --format xml \"select * from geo.countries where name='Congo'\"``\r\n``xml 23424779 Country Congo ``\r\n\r\n- ***xml + diagnostics***\r\n\r\n``shell $ myql-cli execute --format xml --diagnostics \"select * from geo.countries where name='Congo'\"``\r\n``xml true 74 69 0.2.75 23424779 Country Congo ``\r\n\r\n- ***json + diagnostics + debug***\r\n\r\n``shell $ myql-cli execute --format json --diagnostices --debug \"select * from geo.countries where name='Congo'\"``\r\n``json { \"query\": { \"count\": 1, \"lang\": \"en-US\", \"diagnostics\": { \"url\": [ { \"content\": \"http://sherpa-bcp5903.dht.yahoo.com:4080/YDHTWebService/V1/get/yql.global/store%3A%2F%2Fdatatables.org%2Falltableswithkeys\", \"execution-stop-time\": \"5\", \"execution-start-time\": \"1\", \"execution-time\": \"4\", \"id\": \"3a511b18-0e52-405d-b804-803933d620eb\" }, { \"content\": \"http://sherpa-bcp5903.dht.yahoo.com:4080/YDHTWebService/V1/get/yql.global/store%3A%2F%2FRjdEzitN2Hceujh3tGHPj6\", \"execution-stop-time\": \"17\", \"execution-start-time\": \"7\", \"execution-time\": \"10\", \"id\": \"ddd7fc5d-b63d-4988-9437-fb678f781e46\" }, { \"content\": \"http://sherpa-bcp5903.dht.yahoo.com:4080/YDHTWebService/V1/get/yql.global/store%3A%2F%2FRjdEzitN2Hceujh3tGHPj6\", \"execution-stop-time\": \"53\", \"execution-start-time\": \"42\", \"execution-time\": \"11\", \"id\": \"43b945b6-b92a-4e74-a58c-9a7b597a8045\" }, { \"content\": \"http://wws.geotech.yahooapis.com/v1/countries;start=0;count=1000\", \"execution-stop-time\": \"156\", \"execution-start-time\": \"79\", \"execution-time\": \"77\" } ], \"user-time\": \"160\", \"build-version\": \"0.2.75\", \"service-time\": \"102\", \"publiclyCallable\": \"true\" }, \"results\": { \"place\": { \"lang\": \"en-US\", \"woeid\": \"23424779\", \"uri\": \"http://where.yahooapis.com/v1/place/23424779\", \"name\": \"Congo\", \"placeTypeName\": { \"content\": \"Country\", \"code\": \"12\" } } }, \"created\": \"2015-04-07T12:39:47Z\" } }``\r\n\r\nYQL Shell\r\n'''''''''\r\n\r\n::\r\n\r\n $ myql-cli shell -h\r\n\r\n::\r\n\r\n $ myql-cli shell\r\n yql> \r\n\r\nTable Manager\r\n'''''''''''''\r\n\r\n::\r\n\r\n $ myql-cli table -h\r\n usage: YQL-cli tools table [-h] [-i] [-c] table\r\n\r\n positional arguments:\r\n table Create a YQL Table from python file\r\n\r\n optional arguments:\r\n -h, --help show this help message and exit\r\n -i, --init Creates a project with a tables.py file in it\r\n -c, --create Creates tables in the tables.py file of your project\r\n\r\n- Initialize the table project\r\n\r\n::\r\n\r\n $ myql-cli table -i lol\r\n $ ls -l lol\r\n __init__.py tables.py\r\n\r\n- Define your table\r\n\r\n::\r\n\r\n $ vim lol/tables.py\r\n\r\n::\r\n\r\n from myql.contrib.table import BinderModel, BinderKey, BinderPage, TableModel, BinderFrom\r\n\r\n class SelectBinder(BinderModel):\r\n name = 'select'\r\n itemPath = 'products.product'\r\n produces = 'xml'\r\n pollingFrequencySeconds = 30\r\n urls = ['http://lol.com/services?artist={artist}','http://lol.com/services/song={song}']\r\n paging = BinderPage('page', {'id': 'ItemPage', 'default': '1'}, {'id':'Count' ,'max':'25'},{'default': '10'})\r\n artist = BinderKey(id='artist', type='xs:string', paramType='path')\r\n song = BinderKey(id='song', type='xs:string', paramType='path', required='true')\r\n \r\n\r\n class TestTable(TableModel):\r\n name = 'Test'\r\n author = 'Josue Kouka'\r\n apiKeyURL = 'http://josuebrunel.org/api'\r\n documentationURL = 'http://josuebrunel.org/doc.html'\r\n sampleQuery = ['SELECT * FROM mytable']\r\n select = BinderFrom(SelectBinder)\r\n\r\n- Generate your table in XML\r\n\r\n::\r\n\r\n $ myql-cli table --create lol\r\n $ ls lol\r\n Test.xml __init__.py __init__.pyc tables.py tables.pyc\r\n\r\n::\r\n\r\n $ cat lol/Test.xml\r\n\r\n::\r\n\r\n \r\n \r\n \r\n Josue Kouka\r\n http://josuebrunel.org/api\r\n http://josuebrunel.org/doc.html\r\n \r\n SELECT * FROM mytable\r\n \r\n \r\n \r\n \r\n
\r\n\r\nVoila\r\n\r\n.. |Build Status| image:: https://travis-ci.org/josuebrunel/myql-cli.svg\r\n.. |Documentation\r\nStatus| image:: https://readthedocs.org/projects/myql-cli/badge/?version=latest", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/josuebrunel/myql-cli/archive/0.2.3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/josuebrunel/myql-cli", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "myql-cli", "package_url": "https://pypi.org/project/myql-cli/", "platform": "Any", "project_url": "https://pypi.org/project/myql-cli/", "project_urls": { "Download": "https://github.com/josuebrunel/myql-cli/archive/0.2.3.tar.gz", "Homepage": "https://github.com/josuebrunel/myql-cli" }, "release_url": "https://pypi.org/project/myql-cli/0.2.3/", "requires_dist": null, "requires_python": null, "summary": "Python command line tool to run YQL queries and generates YQL Tables", "version": "0.2.3" }, "last_serial": 1553082, "releases": { "0.2.3": [ { "comment_text": "", "digests": { "md5": "fada649f5cf4e984e71755f05290ea11", "sha256": "843fda9a38fd22bfc7c7b8e3c2902e6f028c54e13b1ac253ed566dbc81ea5603" }, "downloads": -1, "filename": "myql-cli-0.2.3.tar.gz", "has_sig": false, "md5_digest": "fada649f5cf4e984e71755f05290ea11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7138, "upload_time": "2015-05-10T19:36:28", "url": "https://files.pythonhosted.org/packages/93/82/4da533e0af8f786c27bb51b1e9142c5217d2cddaaff7e58b5c93b0478e19/myql-cli-0.2.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fada649f5cf4e984e71755f05290ea11", "sha256": "843fda9a38fd22bfc7c7b8e3c2902e6f028c54e13b1ac253ed566dbc81ea5603" }, "downloads": -1, "filename": "myql-cli-0.2.3.tar.gz", "has_sig": false, "md5_digest": "fada649f5cf4e984e71755f05290ea11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7138, "upload_time": "2015-05-10T19:36:28", "url": "https://files.pythonhosted.org/packages/93/82/4da533e0af8f786c27bb51b1e9142c5217d2cddaaff7e58b5c93b0478e19/myql-cli-0.2.3.tar.gz" } ] }