{ "info": { "author": "Michel Casabianca", "author_email": "casa@sweetohm.net", "bugtrack_url": null, "classifiers": [], "description": "sqlplus\\_commando\n=================\n\nInstalling a Oracle driver on a machine is sometime a pain, or even\nimpossible. Furthermore you may want to distribute self contained\nscripts that access Oracle without having to ask for additional software\ninstallation. Finally, you may want to automate scripts that should run\nwith SQL\\*Plus.\n\n*sqlplus\\_commando* is a pure Python Oracle driver that calls *sqlplus*\non the command line. It was designed so that you may use it by dropping\nits module in your source tree or even copy its classes in your own\nsource code.\n\nInstallation\n------------\n\nTo install *sqlplus\\_commando*, you may use one of the following\nmethods:\n\n- Extract classes ``SqlplusCommando``, ``OracleResultParser``\u00a0and\n ``OracleErrorParser`` from tarball (in file\n *sqlplus\\_commando/sqlplus\\_commando.py*) and put it in your own\n source code.\n- Drop its module (file *sqlplus\\_commando/sqlplus\\_commando.py* in the\n tarball) in your source directory.\n- Install it using PIP, typing ``pip install sqlplus_commando``.\n- Install from tarball typing ``python setup.py install``.\n\nThe Apache license grants you a right to use this driver in any of your\nproject (even commercial) provided that you mention that you are using\n*sqlplus\\_commando* in your copyright notice.\n\nUsage\n-----\n\nYou can use this driver in your code just like so:\n\n.. code:: python\n\n from sqlplus_commando import SqlplusCommando\n\n sqlplus = SqlplusCommando(hostname='localhost', database='test',\n username='test', password='test')\n result = sqlplus.run_query(\"SELECT 42 AS response, 'This is a test' AS question FROM DUAL;\")\n print result\n\nWhen query returns nothing (after an ``INSERT`` for instance), method\n``run_query()`` will return an empty tuple ``()``. If query returns a\nresult set, this will be a tuple of dictionaries. For instance, previous\nsample code could print:\n\n.. code:: python\n\n ({'RESPONSE': 42, 'QUESTION': 'This is a test'},)\n\nInstead of running a query you may run a script as follows:\n\n.. code:: python\n\n result = sqlplus.run_script('my_script.sql')\n\nParameters\n----------\n\nYou can have values such as ``%(foo)s`` in your query that will be\nreplaced with corresponding value of the parameters dictionary. For\ninstance:\n\n.. code:: python\n\n from sqlplus_commando import SqlplusCommando\n\n sqlplus = SqlplusCommando(hostname='localhost', database='test',\n username='test', password='test')\n parameters = {'name': 'Reglisse'}\n result = sqlplus.run_query(query=\"SELECT * FROM animals WHERE name=%(name)s\",\n parameters=parameters)\n print result\n\nYou may not provide parameters running a script. To do so, call\n``run_query()`` with parameters passing query\n``open('my_script.sql').read()``.\n\nResult set types\n----------------\n\n*sqlplus\\_commando* performs auto casting before returning result sets.\nAs it calls *sqlplus* on command line, every value in the result set is\na string. For convenience, it casts integers, floats, dates and NULL\ninto native Python types.\n\nThere are situations where this might not be accurate. For instance, if\na column is of SQL type ``VARCHAR(10)`` and contain phone numbers, all\nits values will be casted to Python integers. It should not because\nphone numbers can start with *0* that would be lost while casted into an\ninteger.\n\nTo avoid this, you may pass ``cast=False`` when calling ``run_query()``\nor ``run_script()``, like so:\n\n.. code:: python\n\n from sqlplus_commando import SqlplusCommando\n\n sqlplus = SqlplusCommando(hostname='localhost', database='test',\n username='test', password='test')\n result = sqlplus.run_query(\"SELECT phone FROM users WHERE name='bob')\", cast=False)\n print result\n\nYou may also disable casting when instantiating the driver, passing\n``cast=False`` to the constructor. This casting configuration will apply\non all calls to ``run_query()`` or ``run_script()`` except if you pass a\ndifferent value while calling these methods.\n\nError management\n----------------\n\nWhile running a query or a script with *sqlplus*, you must add following\nSQL commands so that the return value is diff\u00e9rent from *0* if an error\noccurs:\n\n.. code:: sql\n\n WHENEVER SQLERROR EXIT SQL.SQLCODE;\n WHENEVER OSERROR EXIT 9;\n\nThese lines are added before queries or scripts to run to avoid having\nto parse the result for error messages. Nevertheless, there are some\ncases when these lines won't help for error detection. For instance,\nfollowing query:\n\n.. code:: sql\n\n BAD SQL QUERY;\n\nThis won't result in an error in *sqlplus* and we must parse the result\nfor the error string ``SP2-0734: unknown command``. This is done by\ndefault, but you may avoid this passing parameter\n``check_unknown_command=False`` while calling functions ``run_query`` or\n``run_script``.\n\nFurthermore, a compilation error will result in a warning, thus it is\noften necessary to check for warnings in *sqlplus* output. This is done\nby default and will result in an exception, except if you pass\n``check_warning=False`` calling ``run_query`` or ``run_script``.\n\nNote\n----\n\nThis module is not intended to replace an genuine Oracle driver that you\n**SHOULD** use if you can install it on the target machine.\n\nEnjoy!", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/sqlplus_commando/", "keywords": null, "license": "Apache Software License", "maintainer": null, "maintainer_email": null, "name": "sqlplus_commando", "package_url": "https://pypi.org/project/sqlplus_commando/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/sqlplus_commando/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/sqlplus_commando/" }, "release_url": "https://pypi.org/project/sqlplus_commando/0.4.2/", "requires_dist": null, "requires_python": null, "summary": "sqlplus_commando is an Oracle driver calling sqlplus", "version": "0.4.2" }, "last_serial": 2285795, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "887a32413b6c975382c36142a9d57f8e", "sha256": "195ea21002960fc2725ea8c24113374e56c0711d0118ebff53b706883df70ada" }, "downloads": -1, "filename": "sqlplus_commando-0.1.0.tar.gz", "has_sig": false, "md5_digest": "887a32413b6c975382c36142a9d57f8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8614, "upload_time": "2016-04-30T13:48:33", "url": "https://files.pythonhosted.org/packages/88/cf/51e2ba93e41baf55a6b7d065d65d50226f8aced0d1843b6ccb76d74240a4/sqlplus_commando-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "13668660b5bd3bc7fe5c3d852f251f7e", "sha256": "219eb4dfc80523a96f399d9a47ea29f2225c8015ef29ae0e26013a4af93c2b6d" }, "downloads": -1, "filename": "sqlplus_commando-0.1.1.tar.gz", "has_sig": false, "md5_digest": "13668660b5bd3bc7fe5c3d852f251f7e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8613, "upload_time": "2016-04-30T14:19:54", "url": "https://files.pythonhosted.org/packages/aa/d6/6ea987c141ede37a11ff16e1bf50c05727ecf34631139cf2947b23636b78/sqlplus_commando-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "11298c45c61b4c69ecdec70079dec074", "sha256": "96ce437285b404b15bd111f32726f569c2313205cafa55eb6b5bffdd66a8fecb" }, "downloads": -1, "filename": "sqlplus_commando-0.1.2.tar.gz", "has_sig": false, "md5_digest": "11298c45c61b4c69ecdec70079dec074", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8597, "upload_time": "2016-04-30T14:29:16", "url": "https://files.pythonhosted.org/packages/de/9b/b676e1dc578e6db5225d7a0315a44d5c8d9a9e9a12b17893cc74d6cafed0/sqlplus_commando-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "54e570c91ce06af62272138091d90a92", "sha256": "bd1c7b9d25b4bf14d3bbd4e293b42e0bc0470deb7920083dab49e4954322dcb7" }, "downloads": -1, "filename": "sqlplus_commando-0.1.3.tar.gz", "has_sig": false, "md5_digest": "54e570c91ce06af62272138091d90a92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8589, "upload_time": "2016-04-30T15:15:48", "url": "https://files.pythonhosted.org/packages/0d/22/1f147bc4741d645cb04bc0a28f6482210ee08a5eaced62a5ce1cd91f8304/sqlplus_commando-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "3831b3aa0db6f3fc696decfa02454b8e", "sha256": "dfbfcf9cfc578ed64c6d7493ba8770f82ad555a1b07c55ab1036fd1440455d46" }, "downloads": -1, "filename": "sqlplus_commando-0.1.4.tar.gz", "has_sig": false, "md5_digest": "3831b3aa0db6f3fc696decfa02454b8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8669, "upload_time": "2016-05-02T15:15:49", "url": "https://files.pythonhosted.org/packages/fa/c4/aa79389c3ef7641a99fc504f2d464085f2940dc34e605dbf04230279722b/sqlplus_commando-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "316b34c44e547411e6d693ef3214fe41", "sha256": "92e974e17096237a9ab244394575760034c57c9b27e13641d409edf1f404f879" }, "downloads": -1, "filename": "sqlplus_commando-0.1.5.tar.gz", "has_sig": false, "md5_digest": "316b34c44e547411e6d693ef3214fe41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8731, "upload_time": "2016-05-03T09:14:43", "url": "https://files.pythonhosted.org/packages/5b/6d/6f80dd29657e21c9ebaaa366a6819e77363859be723b783485872dd84678/sqlplus_commando-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "2228e798210ae52f7a608f5252e61b6d", "sha256": "117bc12aca7e8faabf4ef849ecf1ffa222863cdbddc36eb8629f83a68d044cf2" }, "downloads": -1, "filename": "sqlplus_commando-0.1.6.tar.gz", "has_sig": false, "md5_digest": "2228e798210ae52f7a608f5252e61b6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8693, "upload_time": "2016-05-17T15:32:30", "url": "https://files.pythonhosted.org/packages/07/5a/fc05a6e31b44097ec41617221a01f09c7c6f405446e027ff99bcfd7873cb/sqlplus_commando-0.1.6.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "520fe0aa6ce058388dfe3de0fadf48e8", "sha256": "56339a3384d53bd6931be5f8a527ab216765897acd624f421e0fe317ca825b47" }, "downloads": -1, "filename": "sqlplus_commando-0.2.0.tar.gz", "has_sig": false, "md5_digest": "520fe0aa6ce058388dfe3de0fadf48e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8859, "upload_time": "2016-05-26T15:37:22", "url": "https://files.pythonhosted.org/packages/c5/d5/cf87ba4efaee6034e61f7aba072638a9a81e7889cecd40d97bdb5e33dbbb/sqlplus_commando-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "f7b7d5ea228414d92d938d5d73f7f5e2", "sha256": "134ef8db484622e7cb4ba1d16a429990ead181ff96ec4fba8093803d9e1c8a5c" }, "downloads": -1, "filename": "sqlplus_commando-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f7b7d5ea228414d92d938d5d73f7f5e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8802, "upload_time": "2016-06-15T15:18:35", "url": "https://files.pythonhosted.org/packages/6e/7a/abab3cb98f97b403a312bc739ee88373b211fbf519564b91c7c7c2143791/sqlplus_commando-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "272cab1468c2198ab442c0d7c1e88222", "sha256": "6078e132014048006091e86ae84fadae7c7753b231c30364fa76c3dde1a57742" }, "downloads": -1, "filename": "sqlplus_commando-0.4.0.tar.gz", "has_sig": false, "md5_digest": "272cab1468c2198ab442c0d7c1e88222", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8901, "upload_time": "2016-07-06T09:52:31", "url": "https://files.pythonhosted.org/packages/d8/84/a9284d86ed54ecf81d48fa879c5daa5b915e2c7bf064bcab1015406c136c/sqlplus_commando-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "41418759e536c1118fa907c0b160fa36", "sha256": "c8fb80086ca5f07008f57628ec0a3f4ba31f23ecc257a36cd82219a8761f3215" }, "downloads": -1, "filename": "sqlplus_commando-0.4.1.tar.gz", "has_sig": false, "md5_digest": "41418759e536c1118fa907c0b160fa36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8834, "upload_time": "2016-08-02T15:55:42", "url": "https://files.pythonhosted.org/packages/fe/eb/c10c32ed821f9f537a89f4c00230df99f1a59246e1271ce111d2e4203686/sqlplus_commando-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "f5c9d11a688d689526b1f3f8c3727f6a", "sha256": "0f11edc08775281f4bb2543252f6cf2cdaa701969ac8994c51d2578cb299f095" }, "downloads": -1, "filename": "sqlplus_commando-0.4.2.tar.gz", "has_sig": false, "md5_digest": "f5c9d11a688d689526b1f3f8c3727f6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8902, "upload_time": "2016-08-17T09:08:24", "url": "https://files.pythonhosted.org/packages/61/34/d1b53002b881b0834c90486e7fdcb9c26bb62c615c06b1aa464f9c190fd2/sqlplus_commando-0.4.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f5c9d11a688d689526b1f3f8c3727f6a", "sha256": "0f11edc08775281f4bb2543252f6cf2cdaa701969ac8994c51d2578cb299f095" }, "downloads": -1, "filename": "sqlplus_commando-0.4.2.tar.gz", "has_sig": false, "md5_digest": "f5c9d11a688d689526b1f3f8c3727f6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8902, "upload_time": "2016-08-17T09:08:24", "url": "https://files.pythonhosted.org/packages/61/34/d1b53002b881b0834c90486e7fdcb9c26bb62c615c06b1aa464f9c190fd2/sqlplus_commando-0.4.2.tar.gz" } ] }