Skip to main content
QUICK REVIEW

[Paper Review] SQLFlow: A Bridge between SQL and Machine Learning

Yi Wang, Yang Yang|arXiv (Cornell University)|Jan 19, 2020
Scientific Computing and Data ManagementDecision Sciences8 references6 citations
TL;DR

SQLFlow is an open-source SQL extension that bridges databases and machine learning systems, enabling end-to-end ML workflows through a unified SQL syntax. It compiles SQL programs into Kubernetes-native workflows, supporting diverse databases (MySQL, Hive, MaxCompute) and ML frameworks (TensorFlow, XGBoost, scikit-learn), with support for training, prediction, and model explanation via SHAP and custom tools.

ABSTRACT

Industrial AI systems are mostly end-to-end machine learning (ML) workflows. A typical recommendation or business intelligence system includes many online micro-services and offline jobs. We describe SQLFlow for developing such workflows efficiently in SQL. SQL enables developers to write short programs focusing on the purpose (what) and ignoring the procedure (how). Previous database systems extended their SQL dialect to support ML. SQLFlow (https://sqlflow.org/sqlflow ) takes another strategy to work as a bridge over various database systems, including MySQL, Apache Hive, and Alibaba MaxCompute, and ML engines like TensorFlow, XGBoost, and scikit-learn. We extended SQL syntax carefully to make the extension working with various SQL dialects. We implement the extension by inventing a collaborative parsing algorithm. SQLFlow is efficient and expressive to a wide variety of ML techniques -- supervised and unsupervised learning; deep networks and tree models; visual model explanation in addition to training and prediction; data processing and feature extraction in addition to ML. SQLFlow compiles a SQL program into a Kubernetes-native workflow for fault-tolerable execution and on-cloud deployment. Current industrial users include Ant Financial, DiDi, and Alibaba Group.

Motivation & Objective

  • To simplify the development of end-to-end machine learning workflows by allowing data scientists and engineers to express ML pipelines in SQL, focusing on 'what' not 'how'.
  • To overcome vendor lock-in and limited extensibility in existing database-extended SQL systems that support ML.
  • To enable interoperability across heterogeneous database and ML systems through a unified, open-source bridge architecture.
  • To provide a scalable, fault-tolerant execution model using Kubernetes-native workflows for industrial ML deployment.
  • To support model explanation, feature engineering, and both supervised and unsupervised learning within a single SQL interface.

Proposed method

  • Extends SQL syntax with new clauses like `TO TRAIN`, `TO PREDICT`, and `TO EXPLAIN` to express ML workflows directly in SQL.
  • Employs a collaborative parsing algorithm that integrates parsers for standard SQL dialects and the SQLFlow syntax extension to ensure compatibility.
  • Compiles SQL programs into Kubernetes-native workflows using a two-tier compilation model: static SQL-to-Couler translation, then Couler-to-YAML workflow generation.
  • Leverages the Couler Python library as a domain-specific language (DSL) to describe workflows, enabling ML researchers to build and debug workflows in Python.
  • Uses workflow orchestration engines like Argo and Tekton to execute workflows with fault tolerance and scalability on Kubernetes clusters.
  • Integrates with model explanation tools like SHAP and custom backends (e.g., text-based SHAP) to support visual and programmatic model interpretability.

Experimental results

Research questions

  • RQ1Can a unified SQL syntax extension effectively express diverse machine learning workflows across multiple databases and ML frameworks?
  • RQ2How can a SQL-based system achieve interoperability with heterogeneous database and ML systems without vendor lock-in?
  • RQ3To what extent can SQLFlow’s compilation stack (SQL → Couler → YAML) improve developer productivity and workflow maintainability compared to raw YAML or imperative code?
  • RQ4Can SQLFlow support both supervised and unsupervised learning, including model explanation, within a single, consistent SQL interface?
  • RQ5How does SQLFlow’s architecture enable efficient, fault-tolerant, and scalable execution of ML pipelines in production environments?

Key findings

  • SQLFlow successfully compiles SQL programs into Kubernetes-native workflows, enabling fault-tolerant and scalable execution of end-to-end ML pipelines.
  • The collaborative parsing algorithm enables SQLFlow to work with multiple SQL dialects (MySQL, Hive, MaxCompute) and ML engines (XGBoost, TensorFlow, scikit-learn) without requiring changes to the underlying systems.
  • The system supports both supervised and unsupervised learning, including model training, prediction, and explanation via SHAP and custom tools like metaplot.
  • The integration with Jupyter Notebook and command-line tools (e.g., `sqlflow compile`) demonstrates usability across interactive and programmatic workflows.
  • The use of Couler as a Python DSL for workflow description enables ML researchers to build and debug complex pipelines efficiently, with a clear compilation path to YAML.
  • The demo shows that a single SQL program can be executed across different environments (local, Docker, cloud) and combined with various databases and ML models, proving the system’s versatility and extensibility.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.