morphsql / model /README.md
waghelad's picture
Upload folder using huggingface_hub
12eff8e verified
|
Raw
History Blame Contribute Delete
1.44 kB

A newer version of the Gradio SDK is available: 6.22.0

Upgrade
metadata
language: en
license: apache-2.0
library_name: morphsql
pipeline_tag: text-classification
tags:
  - code
  - sql
  - agent
  - text-generation
  - text-classification
  - rag
  - sklearn
  - migration
  - snowflake
  - dbt
datasets:
  - dgvj-work/vertica-snowflake-pairs
metrics:
  - accuracy

MorphSQL risk classifier

Small TF-IDF + LogisticRegression model that scores SQL migration risk (low / medium / high).

Used by MorphSQL (Space).
Python package import: morphsql (PyPI: morphsql).

Files

File Purpose
risk_classifier.joblib sklearn pipeline
rewrite_vocabulary.json common SQL rewrite map
config.json dialects + metadata

Usage

from huggingface_hub import hf_hub_download
import joblib

path = hf_hub_download(repo_id="dgvj-work/morphsql", filename="risk_classifier.joblib")
clf = joblib.load(path)
print(clf.predict(["EXECUTE IMMEDIATE 'SELECT 1'"]))
from morphsql.ai import pipeline
print(pipeline("sql-risk-classification")("CREATE PROCEDURE p AS BEGIN NULL; END;"))
print(pipeline("sql-migration")("SELECT ZEROIFNULL(a) FROM t"))

Links

Author: Digvijay Waghela · Apache-2.0