Repository: mlflow/mlflow

Issue:
ERROR mlflow.cli: Error initializing backend store (Postgres backend)
### System information
- **Have I written custom code (as opposed to using a stock example script provided in MLflow)**: No
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: MacOS 10.14.5 & Docker for Mac 2.0.0.3
- **MLflow installed from (source or binary)**:  binary pip install
- **MLflow version (run ``mlflow --version``)**: 1.0.0
- **Python version**: 2.7
- **npm version (if running the dev UI): N/A
- **Exact command to reproduce**: 
```
mlflow server \
   --backend-store-uri postgresql://mlflow_user:mlflow_pw@pgdb/mlflow_db  \
   --default-artifact-root /artifacts  \
   --host 0.0.0.0 \
   --port 5000
```

### Describe the problem
When the `mlflow server` starts, the following messages appear:
```
2019/06/24 23:34:49 ERROR mlflow.cli: Error initializing backend store
2019/06/24 23:34:49 ERROR mlflow.cli: (psycopg2.errors.SyntaxError) syntax error at or near "/"
LINE 1: ...on, lifecycle_stage, name, experiment_id) VALUES (/artifacts...
                                                             ^

[SQL: INSERT INTO experiments (artifact_location, lifecycle_stage, name, experiment_id) VALUES (/artifacts/0, 'active', 'Default', 0);]
(Background on this error at: http://sqlalche.me/e/f405)
Traceback (most recent call last):
  File "/opt/conda/lib/python2.7/site-packages/mlflow/cli.py", line 247, in server
    _get_store(backend_store_uri, default_artifact_root)
  File "/opt/conda/lib/python2.7/site-packages/mlflow/server/handlers.py", line 35, in _get_store
    _store = SqlAlchemyStore(store_dir, artifact_root)
  File "/opt/conda/lib/python2.7/site-packages/mlflow/store/sqlalchemy_store.py", line 96, in __init__
    self._create_default_experiment(session)
  File "/opt/conda/lib/python2.7/contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/conda/lib/python2.7/site-packages/mlflow/store/sqlalchemy_store.py", line 152, in make_managed_session
    raise MlflowException(message=e, error_code=INTERNAL_ERROR)
MlflowException: (psycopg2.errors.SyntaxError) syntax error at or near "/"
LINE 1: ...on, lifecycle_stage, name, experiment_id) VALUES (/artifacts...
                                                             ^

[SQL: INSERT INTO experiments (artifact_location, lifecycle_stage, name, experiment_id) VALUES (/artifacts/0, 'active', 'Default', 0);]
(Background on this error at: http://sqlalche.me/e/f405)
```

### Source code / logs
Root cause:  From what I can tell the issue results from this code fragment in `def  _create_default_experiment` function:
```
        def decorate(s):
            if isinstance(s, str):
                return "'{}'".format(s)
            else:
                return "{}".format(s)
```

The `decorate()` function does not properly detect that  `/artifacts/0` is `str` type.  Testing I've done indicate that `/artifacts/0` is stored as `unicode` type, hence the single quotes are not added to the value.

I'll submit a PR to update the `decorate()` function to handle both `str` and `unicode` data types.


Discussion:

Resolving patch:
diff --git a/mlflow/store/sqlalchemy_store.py b/mlflow/store/sqlalchemy_store.py
--- a/mlflow/store/sqlalchemy_store.py
+++ b/mlflow/store/sqlalchemy_store.py
@@ -178,7 +178,7 @@ def _create_default_experiment(self, session):
         default_experiment = {
             SqlExperiment.experiment_id.name: int(SqlAlchemyStore.DEFAULT_EXPERIMENT_ID),
             SqlExperiment.name.name: Experiment.DEFAULT_EXPERIMENT_NAME,
-            SqlExperiment.artifact_location.name: self._get_artifact_location(0),
+            SqlExperiment.artifact_location.name: str(self._get_artifact_location(0)),
             SqlExperiment.lifecycle_stage.name: LifecycleStage.ACTIVE
         }
 


Test patch: