This repository provides a MLflow plugin that allows users to use SQL Server as the artifact store for MLflow.
To install this plugin package:
- Initialize the custom
mlflowsubmodule by running the following command from the repository root:
$ git submodule update --init
- Invoke the
install.shscript from the repository's root directory. This script usespipto install thesqlpluginlibrary (which provides a custom artifact repository implementation) as well as a custom version of the MLflow library that defines a[sqlserver]extras tag to automatically install thesqlplugindependency when MLflow is installed (this is not strictly required for the plugin to work).
Once the plugin has been installed along with the custom version of MLflow, run the artifact logging test Python script located at tests/log_artifacts.py. If this Python script creates an mlruns directory and a SQLite database called testartifactdb without emitting errors, the plugin is working as expected.
This repository contains two main Python packages:
sqlplugin: This package includes theDBArtifactRepositoryclass that is used to read and write artifacts from SQL databases. This class sets the attributeis_plugin = Truein order to indicate that the class is an MLflow artifact repository plugin. This package also includes the SQLAlchemy database models referenced byDBArtifactRepository. The package'ssetup.pyfile defines entrypoints that tell MLflow to automatically associate themssqlURIs with theDBArtifactRepositoryimplementation when thesqlpluginlibrary is installed. The entrypoints are configured as follows:
entry_points={
"mlflow.artifact_repository": [
"mssql=sqlplugin.store:DBArtifactRepository"
]
},
mlflow: This package refers to a branch of the MLflow repository based on the MLflow version 1.3.0 release. This custom branch applies the changes in this PR: dbczumar/mlflow#4. This PR simply defines a custom installation parameter called[sqlserver], which enables the user to install MLflow andsqlplugintogether by running:pip install mlflow[sqlserver]. This is a nice-to-have feature that makes thesqlpluginlibrary easier to install along with MLflow, but it is not strictly required for the plugin to work
The proposed plugin structure and development workflow provide the following experience to the end user:
Users can simply install MLflow with the SQL Server plugin via pip install mlflow[sqlserver] and then use MLflow as normal. The SQLServer artifact support will be provided automatically using the previously-described setup entrypoints mechanism.