mlsanityData to 14 Oct 2026

Efficient and Accurate In-Database Machine Learning with SQL Code Generation in Python

arXiv 2104.03224 ↗First posted 7 Apr 2021cs.DB cs.LGcited by 0

Not on the map. Why?

Abstract (arXiv)

Following an analysis of the advantages of SQL-based Machine Learning (ML) and a short literature survey of the field, we describe a novel method for In-Database Machine Learning (IDBML). We contribute a process for SQL-code generation in Python using template macros in Jinja2 as well as the prototype implementation of the process. We describe our implementation of the process to compute multidimensional histogram (MDH) probability estimation in SQL. For this, we contribute and implement a novel discretization method called equal quantized rank binning (EQRB) and equal-width binning (EWB). Based on this, we provide data gathered in a benchmarking experiment for the quantitative empirical evaluation of our method and system using the Covertype dataset. We measured accuracy and computation time and compared it to Scikit Learn state of the art classification algorithms. Using EWB, our multidimensional probability estimation was the fastest of all tested algorithms, while being only 1-2% less accurate than the best state of the art methods found (decision trees and random forests). Our method was significantly more accurate than Naive Bayes, which assumes independent one-dimensional probabilities and/or densities. Also, our method was significantly more accurate and faster than logistic regression. This motivates for further research in accuracy improvement and in IDBML with SQL code generation for big data and larger-than-memory datasets.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 2 of its 19 references that are in the map. First posted on arXiv 7 Apr 2021.

Builds on

2 of 19 references.

References · 2

  1. 2017Cognitive Database: A Step towards Endowing Relational Databases with Artificial Intelligence Capabilitiescited by 6
  2. 2020SQLFlow: A Bridge between SQL and Machine Learningcited by 4

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025Confidence Estimation for Error Detection in Text-to-SQL Systems
  2. 2024SQL-GEN: Bridging the Dialect Gap for Text-to-SQL Via Synthetic Data And Model Merging
  3. 2025Datrics Text2SQL: A Framework for Natural Language to SQL Query Generation
  4. 2024SelECT-SQL: Self-correcting ensemble Chain-of-Thought for Text-to-SQL
  5. 2025Rationalization Models for Text-to-SQL
  6. 2025Cheaper, Better, Faster, Stronger: Robust Text-to-SQL without Chain-of-Thought or Fine-Tuning
  7. 2025ExeSQL: Self-Taught Text-to-SQL Models with Execution-Driven Bootstrapping for SQL Dialects
  8. 2025OmniSQL: Synthesizing High-quality Text-to-SQL Data at Scale