MySQL-NLP-CLI


NameMySQL-NLP-CLI JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA Python package that allows to use the CLI and Natural Language processing to write MySQL queries.
upload_time2025-02-22 12:51:12
maintainerNone
docs_urlNone
authorKunaal Gadhalay
requires_python>=3.6
licenseNone
keywords python cli nlp mysql command line interface natural language processing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
*README.md*



# Natural Language MySQL Schema Creator



[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)



A Python package that converts natural language commands into MySQL database schemas through both CLI and interactive modes.



## Features



- ๐Ÿ—ฃ๏ธ Natural language processing for schema creation

- ๐Ÿ”’ Secure database connections with parameterized queries

- ๐Ÿ’ป Interactive CLI mode with guided prompts

- ๐Ÿ“ Support for both text input and file input

- ๐Ÿ› ๏ธ Schema validation and error recovery

- ๐Ÿ”„ Connection pooling for better performance

- ๐Ÿงช Dry-run mode for SQL preview



## Installation



bash

pip install MySQL_NLP_CLI

python -m spacy download en_core_web_sm





## Usage



### Command Line Interface



bash

# Natural language input

mysql_nlp_cli -t "Create database 'ecommerce' with table users (id int primary key)" -u root



# File input

mysql_nlp_cli -f schema.txt -u root --dry-run



# Interactive mode

mysql_nlp_cli -i -u root





### Natural Language Examples



Input:

text

Create database 'inventory' with tables:

- products (id int primary key, name varchar(255) not null, price decimal(10,2))

- orders (order_id int auto_increment, product_id int, quantity int)





Generated SQL:

sql

CREATE DATABASE inventory CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

USE inventory;



CREATE TABLE products (

  id INT PRIMARY KEY,

  name VARCHAR(255) NOT NULL,

  price DECIMAL(10,2)

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;



CREATE TABLE orders (

  order_id INT AUTO_INCREMENT,

  product_id INT,

  quantity INT

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;





### Interactive Mode Demo



text

$  mysql_nlp_cli -i -u root



=== MySQL Schema Creator ===



Database name: my_shop



Add table? [Y/n]: y



Table name: customers



Column name: id

Data type: INT

Primary key? [y/N]: y

Nullable? [Y/n]: n



Add another column? [Y/n]: y



Column name: email

Data type: VARCHAR

Length: 255

Nullable? [Y/n]: n

Unique constraint? [y/N]: y



[1] Continue to database creation

[2] Preview SQL

[3] Cancel



Choice: 2



Generated SQL:

...





## Configuration



Environment variables (optional):

env

MYSQL_HOST=localhost

MYSQL_PORT=3306

MYSQL_USER=root





## Features



- **Natural Language Processing**

  - Automatic type conversion

  - Constraint detection (primary key, nullability)

  - Multi-table support

  - Complex column definitions



- **Security**

  - Password masking

  - SQL injection prevention

  - Connection encryption

  - Schema validation



- **Interactive Mode**

  - Step-by-step guidance

  - Real-time validation

  - Error recovery

  - SQL preview



## Contributing



1. Fork the repository

2. Create your feature branch (`git checkout -b feature/awesome-feature`)

3. Commit your changes (`git commit -am 'Add awesome feature'`)

4. Push to the branch (`git push origin feature/awesome-feature`)

5. Open a Pull Request



## License



This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.



## Troubleshooting



**Q: Getting "Language model not found" error**

bash

python -m spacy download en_core_web_sm





**Q: MySQL connection issues**

- Verify MySQL server is running

- Check firewall settings

- Validate user permissions



**Q: Schema validation errors**

- Ensure names follow [a-zA-Z0-9_] pattern

- Check for duplicate primary keys

- Verify supported data types





This documentation provides users with comprehensive information about the package while maintaining professional formatting and clear organization. The README includes:



1. Badges for quick info

2. Feature highlights

3. Installation instructions

4. Usage examples

5. Configuration guidance

6. Development guidelines

7. Troubleshooting common issues

8. License information


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "MySQL-NLP-CLI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "python, cli, NLP, mysql, Command, Line, Interface, Natural, Language, Processing",
    "author": "Kunaal Gadhalay",
    "author_email": "<kunaalgadhalay93@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c5/32/68ef7d654da74a02b276ebe980829bccf57acb0ec3d292e9297447b15877/mysql_nlp_cli-1.0.0.tar.gz",
    "platform": null,
    "description": "\r\n*README.md*\r\r\n\r\r\n# Natural Language MySQL Schema Creator\r\r\n\r\r\n[![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/)\r\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\r\n\r\r\nA Python package that converts natural language commands into MySQL database schemas through both CLI and interactive modes.\r\r\n\r\r\n## Features\r\r\n\r\r\n- \ud83d\udde3\ufe0f Natural language processing for schema creation\r\r\n- \ud83d\udd12 Secure database connections with parameterized queries\r\r\n- \ud83d\udcbb Interactive CLI mode with guided prompts\r\r\n- \ud83d\udcdd Support for both text input and file input\r\r\n- \ud83d\udee0\ufe0f Schema validation and error recovery\r\r\n- \ud83d\udd04 Connection pooling for better performance\r\r\n- \ud83e\uddea Dry-run mode for SQL preview\r\r\n\r\r\n## Installation\r\r\n\r\r\nbash\r\r\npip install MySQL_NLP_CLI\r\r\npython -m spacy download en_core_web_sm\r\r\n\r\r\n\r\r\n## Usage\r\r\n\r\r\n### Command Line Interface\r\r\n\r\r\nbash\r\r\n# Natural language input\r\r\nmysql_nlp_cli -t \"Create database 'ecommerce' with table users (id int primary key)\" -u root\r\r\n\r\r\n# File input\r\r\nmysql_nlp_cli -f schema.txt -u root --dry-run\r\r\n\r\r\n# Interactive mode\r\r\nmysql_nlp_cli -i -u root\r\r\n\r\r\n\r\r\n### Natural Language Examples\r\r\n\r\r\nInput:\r\r\ntext\r\r\nCreate database 'inventory' with tables:\r\r\n- products (id int primary key, name varchar(255) not null, price decimal(10,2))\r\r\n- orders (order_id int auto_increment, product_id int, quantity int)\r\r\n\r\r\n\r\r\nGenerated SQL:\r\r\nsql\r\r\nCREATE DATABASE inventory CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;\r\r\nUSE inventory;\r\r\n\r\r\nCREATE TABLE products (\r\r\n  id INT PRIMARY KEY,\r\r\n  name VARCHAR(255) NOT NULL,\r\r\n  price DECIMAL(10,2)\r\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\r\r\n\r\r\nCREATE TABLE orders (\r\r\n  order_id INT AUTO_INCREMENT,\r\r\n  product_id INT,\r\r\n  quantity INT\r\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\r\r\n\r\r\n\r\r\n### Interactive Mode Demo\r\r\n\r\r\ntext\r\r\n$  mysql_nlp_cli -i -u root\r\r\n\r\r\n=== MySQL Schema Creator ===\r\r\n\r\r\nDatabase name: my_shop\r\r\n\r\r\nAdd table? [Y/n]: y\r\r\n\r\r\nTable name: customers\r\r\n\r\r\nColumn name: id\r\r\nData type: INT\r\r\nPrimary key? [y/N]: y\r\r\nNullable? [Y/n]: n\r\r\n\r\r\nAdd another column? [Y/n]: y\r\r\n\r\r\nColumn name: email\r\r\nData type: VARCHAR\r\r\nLength: 255\r\r\nNullable? [Y/n]: n\r\r\nUnique constraint? [y/N]: y\r\r\n\r\r\n[1] Continue to database creation\r\r\n[2] Preview SQL\r\r\n[3] Cancel\r\r\n\r\r\nChoice: 2\r\r\n\r\r\nGenerated SQL:\r\r\n...\r\r\n\r\r\n\r\r\n## Configuration\r\r\n\r\r\nEnvironment variables (optional):\r\r\nenv\r\r\nMYSQL_HOST=localhost\r\r\nMYSQL_PORT=3306\r\r\nMYSQL_USER=root\r\r\n\r\r\n\r\r\n## Features\r\r\n\r\r\n- **Natural Language Processing**\r\r\n  - Automatic type conversion\r\r\n  - Constraint detection (primary key, nullability)\r\r\n  - Multi-table support\r\r\n  - Complex column definitions\r\r\n\r\r\n- **Security**\r\r\n  - Password masking\r\r\n  - SQL injection prevention\r\r\n  - Connection encryption\r\r\n  - Schema validation\r\r\n\r\r\n- **Interactive Mode**\r\r\n  - Step-by-step guidance\r\r\n  - Real-time validation\r\r\n  - Error recovery\r\r\n  - SQL preview\r\r\n\r\r\n## Contributing\r\r\n\r\r\n1. Fork the repository\r\r\n2. Create your feature branch (`git checkout -b feature/awesome-feature`)\r\r\n3. Commit your changes (`git commit -am 'Add awesome feature'`)\r\r\n4. Push to the branch (`git push origin feature/awesome-feature`)\r\r\n5. Open a Pull Request\r\r\n\r\r\n## License\r\r\n\r\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\r\n\r\r\n## Troubleshooting\r\r\n\r\r\n**Q: Getting \"Language model not found\" error**\r\r\nbash\r\r\npython -m spacy download en_core_web_sm\r\r\n\r\r\n\r\r\n**Q: MySQL connection issues**\r\r\n- Verify MySQL server is running\r\r\n- Check firewall settings\r\r\n- Validate user permissions\r\r\n\r\r\n**Q: Schema validation errors**\r\r\n- Ensure names follow [a-zA-Z0-9_] pattern\r\r\n- Check for duplicate primary keys\r\r\n- Verify supported data types\r\r\n\r\r\n\r\r\nThis documentation provides users with comprehensive information about the package while maintaining professional formatting and clear organization. The README includes:\r\r\n\r\r\n1. Badges for quick info\r\r\n2. Feature highlights\r\r\n3. Installation instructions\r\r\n4. Usage examples\r\r\n5. Configuration guidance\r\r\n6. Development guidelines\r\r\n7. Troubleshooting common issues\r\r\n8. License information\r\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package that allows to use the CLI and Natural Language processing to write MySQL queries.",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        " cli",
        " nlp",
        " mysql",
        " command",
        " line",
        " interface",
        " natural",
        " language",
        " processing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4a30521b9748c3607c0ce0bece884890b0f566e833f3c6bda74b6b4090062d36",
                "md5": "3cd1e489c0efe9cc5ddd8198dba5bd5b",
                "sha256": "34d239844b455c3a1268f18ac4ad69883bab8a36878954c7f1eb39afc12c7fdc"
            },
            "downloads": -1,
            "filename": "MySQL_NLP_CLI-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3cd1e489c0efe9cc5ddd8198dba5bd5b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11376,
            "upload_time": "2025-02-22T12:51:09",
            "upload_time_iso_8601": "2025-02-22T12:51:09.796084Z",
            "url": "https://files.pythonhosted.org/packages/4a/30/521b9748c3607c0ce0bece884890b0f566e833f3c6bda74b6b4090062d36/MySQL_NLP_CLI-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c53268ef7d654da74a02b276ebe980829bccf57acb0ec3d292e9297447b15877",
                "md5": "42fdd28d121b545ef62c461711a60b5d",
                "sha256": "dc3a3b373238e69c6cde97a378919174c2228dc0e6e4aff6682c2ef3044e9a74"
            },
            "downloads": -1,
            "filename": "mysql_nlp_cli-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "42fdd28d121b545ef62c461711a60b5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9775,
            "upload_time": "2025-02-22T12:51:12",
            "upload_time_iso_8601": "2025-02-22T12:51:12.416895Z",
            "url": "https://files.pythonhosted.org/packages/c5/32/68ef7d654da74a02b276ebe980829bccf57acb0ec3d292e9297447b15877/mysql_nlp_cli-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-22 12:51:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mysql-nlp-cli"
}
        
Elapsed time: 0.41579s