:orphan:

==================
Connecting to MLDB
==================

Data Science & AI Workbench enables you to easily connect to MLDB, an open-source database designed for machine learning.

To do so, you'll need to install the ``pymldb`` and ``tqdm`` pip packages, which contain the Python interface for MLDB and a progress meter::

   pip install pymldb tqdm

**NOTES:** 

* ``pymldb`` works with Python 2 only.

* Any packages you install from the command line are available *during the current session only*. If you want them to persist, add them to the project's ``anaconda-project.yml`` file. For more information, see :doc:`../projects/project-config`.

You can then use code such as this to import the library and connect to MLDB from within a notebook session:

.. code-block:: python
   
   # Import the library
   from pymldb import Connection


   # Setup the connection to MLDB install
   mldb = Connection('http://path-to-your-mldb.com:8080')

   # Query the database
   mldb.query("select * from example")
