{ "info": { "author": "Jay Sweeney", "author_email": "writetojay@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Framework :: IPython", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Database :: Front-Ends", "Topic :: System :: Shells" ], "description": "ipydb: Work with databases in IPython\r\n=====================================\r\n \r\n.. image:: https://travis-ci.org/jaysw/ipydb.svg?branch=master\r\n :target: https://travis-ci.org/jaysw/ipydb\r\n\r\n\r\n.. image:: https://coveralls.io/repos/jaysw/ipydb/badge.png?branch=master\r\n :target: https://coveralls.io/r/jaysw/ipydb?branch=master\r\n\r\n\r\nipydb is an `IPython `_ plugin for running SQL queries and viewing their results.\r\n\r\nUsage\r\n-----\r\n\r\nSome demonstration videos are available in the `documentation `_ \r\n\r\n.. code-block:: pycon\r\n\r\n $ ipython\r\n In [1] : %load_ext ipydb\r\n In [2] : %automagic on\r\n Automagic is ON, % prefix IS NOT needed for line magics.\r\n\r\n In [3] : connecturl mysql://user:pass@localhost/employees\r\n In [4] localhost/employees: tables\r\n departments\r\n dept_emp\r\n dept_manager\r\n employees\r\n salaries\r\n titles\r\n\r\n In [5] localhost/employees: fields departments\r\n departments\r\n -----------\r\n dept_name VARCHAR(40)\r\n dept_no CHAR(4)\r\n\r\n In [6] localhost/employees: select * from departments order by dept_name\r\n +---------+--------------------+\r\n | dept_no | dept_name |\r\n +---------+--------------------+\r\n | d009 | Customer Service |\r\n | d005 | Development |\r\n | d002 | Finance |\r\n | d003 | Human Resources |\r\n | d001 | Marketing |\r\n | d004 | Production |\r\n | d006 | Quality Management |\r\n | d008 | Research |\r\n | d007 | Sales |\r\n\r\n\r\nFeatures\r\n--------\r\n\r\n - Tab-completion of table names, fields and joins\r\n - View query results in ascii-table format piped through less\r\n - Single-line or multi-line query editing\r\n - Tab-completion metadata is read in the background and persisted across sessions\r\n - Cross-database support, thanks to SqlAlchemy: `supported databases `_ \r\n\r\n\r\nInstallation\r\n------------\r\n\r\nTo install ipydb:\r\n\r\n.. code-block:: bash\r\n\r\n $ pip install ipydb\r\n\r\nYou will need a python driver for your database of choice. For example:\r\n\r\n.. code-block:: bash\r\n \r\n $ pip install mysql-python\r\n\r\nipydb uses `SqlAlchemy `_ to interact with databases.\r\nSee the `Supported Databases `_ page\r\nfor a (large!) list of supported `DB-API 2.0 `_ drivers and how to\r\nwrite a connection URL for your particular database.\r\n\r\n\r\nStart ipython and load the ipydb plugin:\r\n\r\n.. code-block:: bash\r\n\r\n $ ipython\r\n In [1]: load_ext ipydb\r\n \r\n \r\nDocumentation\r\n-------------\r\n \r\nDocumentation is available at: http://ipydb.readthedocs.org\r\n \r\n\r\nConnecting to Databases\r\n-----------------------\r\n \r\nThere are two ways to connect to a database with ipydb. Directly via a connection url, using\r\nthe ``connecturl`` magic function, or, using a connection 'nickname' with the ``connect`` magic function.\r\n\r\n1. Using ``connecturl``\r\n^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nYou can connect to a database using an SqlAlchemy style url as follows:\r\n\r\n.. code-block:: pycon\r\n\r\n %connecturl drivername://username:password@host/database\r\n\r\nSome examples:\r\n\r\n.. code-block:: pycon\r\n\r\n In [3] : connecturl mysql://myuser:mypass@localhost/mydatabase\r\n In [4] : connecturl sqlite:///path/to/mydb.sqlite\r\n In [5] : connecturl sqlite:///:memory:\r\n\r\nSee the `SqlAlchemy Documentation `_ for further information.\r\n\r\n2. Using ``connect`` and a ``.db-connections`` configuration file\r\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nFor this to work, you need to create a file called\r\n``.db-connections`` located in your home directory.\r\n``.db-connections`` is an \"ini\" formatted file,\r\nparsable by python's ConfigParser module.\r\n\r\nHere's an example of what ``~/.db-connections`` might look like:\r\n\r\n.. code-block:: ini\r\n\r\n [mydb]\r\n type = mysql\r\n username = root\r\n password = xxxx\r\n host = localhost\r\n database = employees\r\n\r\n [myotherdb]\r\n type = sqlite\r\n database = /path/to/file.sqlite\r\n\r\nEach database connection defined in ``~/.db-connections`` is\r\nthen referenceable via its [section heading]. So with the\r\nabove ``.db-connections`` file, the following examples would work:\r\n\r\n.. code-block:: pycon\r\n\r\n In [6] : connect mydb\r\n In [7] mydb : connect myotherdb", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jaysw/ipydb/archive/0.0.2.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jaysw/ipydb", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "ipydb", "package_url": "https://pypi.org/project/ipydb/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ipydb/", "project_urls": { "Download": "https://github.com/jaysw/ipydb/archive/0.0.2.tar.gz", "Homepage": "http://github.com/jaysw/ipydb" }, "release_url": "https://pypi.org/project/ipydb/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Turn your IPython console into a cross-database SQL client", "version": "0.0.2" }, "last_serial": 1239854, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "1edc0ff99c8eb690eb887813233045b7", "sha256": "f99840133fb88a5541f576c63b5911356e707d1cab612e80234b02a8d6b2d8ae" }, "downloads": -1, "filename": "ipydb-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1edc0ff99c8eb690eb887813233045b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24723, "upload_time": "2014-09-22T03:24:40", "url": "https://files.pythonhosted.org/packages/20/b7/363aeff3e8d73ac3faf0479719b5508b708b6c329bb4173f1d77d6520ba1/ipydb-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1edc0ff99c8eb690eb887813233045b7", "sha256": "f99840133fb88a5541f576c63b5911356e707d1cab612e80234b02a8d6b2d8ae" }, "downloads": -1, "filename": "ipydb-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1edc0ff99c8eb690eb887813233045b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24723, "upload_time": "2014-09-22T03:24:40", "url": "https://files.pythonhosted.org/packages/20/b7/363aeff3e8d73ac3faf0479719b5508b708b6c329bb4173f1d77d6520ba1/ipydb-0.0.2.tar.gz" } ] }