Skip to main content

ai-mysql-translator

PyPI version License: MIT Downloads LinkedIn

Overview

A package enables AI systems to securely interact with MySQL databases by translating natural language queries into structured SQL commands. It processes user text input to generate safe, validated database operations, ensuring responses are consistent and free from injection risks. This allows AI assistants to perform data retrieval and manipulation without exposing sensitive database structures or requiring manual query writing.

Installation

pip install ai_mysql_translator

Usage

from ai_mysql_translator import ai_mysql_translator
user_input: str
api_key: Optional[str] = None
llm: Optional[BaseChatModel] = None

response = ai_mysql_translator(
    user_input, 
    api_key=api_key, 
    llm=llm 
)

You can safely pass your own llm instance (based on https://docs.langchain.com/) if you prefer to use a different LLM. For example, to use the OpenAI LLM, you can use:

from langchain_openai import ChatOpenAI
import ai_mysql_translator

llm = ChatOpenAI()
response = ai_mysql_translator(
    user_input,
    llm=llm
)

Or to use the Anthropic LLM, you can use:

from langchain_anthropic import ChatAnthropic
import ai_mysql_translator

llm = ChatAnthropic()
response = ai_mysql_translator(
    user_input,
    llm=llm
)

Or Google Generative AI LLM, use:

from langchain_google_genai import ChatGoogleGenerativeAI
import ai_mysql_translator

llm = ChatGoogleGenerativeAI()
response = ai_mysql_translator(
    user_input,
    llm=llm
)

The package uses the ChatLLM7 from langchain_llm7 (https://pypi.org/project/langchain-llm7/) by default.

If you need higher rate limits for LLM7, you can pass your own API key via environment variable LLM7_API_KEY or directly via api_key. You can obtain a free API key by registering at https://token.llm7.io/.

GitHub

Author

Metadata

Release files for ai-mysql-translator 2025.12.21101721

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-mysql-translator 2025.12.21101721
File Size Uploaded Provenance Actions
ai_mysql_translator-2025.12.21101721.tar.gz 4.6 kB Without provenance Details for ai_mysql_translator-2025.12.21101721.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-mysql-translator 2025.12.21101721
File Interpreter ABI Platform Actions
ai_mysql_translator-2025.12.21101721-py3-none-any.whl Python 3 none any Details for ai_mysql_translator-2025.12.21101721-py3-none-any.whl

Total release size: 9.9 kB

Release files / ai_mysql_translator-2025.12.21101721.tar.gz

Download URL ai_mysql_translator-2025.12.21101721.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
adf75f05539b324fd0d56ff5d0ebb0767d550adfcdf15bece059c0365659f4d5
BLAKE2b-256 checksum
How to use checksums
7715149ce95f6c0d2e9ce9b0ea29619f448dcc43ccc8697ec99ba058ef6f3c25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / ai_mysql_translator-2025.12.21101721-py3-none-any.whl

Download URL ai_mysql_translator-2025.12.21101721-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c4a0709f6ac6c370d9dc370fa293f685a9da2c74948af9580f13a11671eb583
BLAKE2b-256 checksum
How to use checksums
e9eb7217d46653b1a874a1cc5cd4dbde7e9a9c7e9662acf4018b6321ba6b2e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Security for ai-mysql-translator 2025.12.21101721

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page