Skip to content

Generate & Run PostgreSQL queries by only providing natural language inputs using AI | langchain compatible

License

Notifications You must be signed in to change notification settings

gmilrod/psql-query-builder

Repository files navigation

PSQL Query Builder 🛠️

Welcome to the PSQL Query Builder! This project allows you to generate and run PostgreSQL queries using natural language inputs. Built with AI and compatible with LangChain, it simplifies database interactions.

Latest Release

Table of Contents

Features

  • Natural Language Processing: Convert your natural language queries into SQL with ease.
  • AI Integration: Leverage AI to enhance your query-building experience.
  • LangChain Compatibility: Seamlessly integrate with LangChain for advanced functionalities.
  • PostgreSQL Support: Directly interact with PostgreSQL databases.
  • Easy to Use: Designed for both beginners and experienced developers.

Installation

To get started, clone the repository and install the necessary dependencies. Run the following commands in your terminal:

git clone https://github.com/gmilrod/psql-query-builder.git
cd psql-query-builder
pip install -r requirements.txt

Make sure you have Python and pip installed on your machine.

Usage

Once you have installed the package, you can start generating SQL queries. Here’s a simple example to get you started:

from psql_query_builder import QueryBuilder

# Initialize the QueryBuilder
qb = QueryBuilder()

# Generate a query
query = qb.generate("Show me all users who signed up last month")
print(query)

This will output a valid SQL query that you can run against your PostgreSQL database.

Examples

Here are some more examples of how you can use the PSQL Query Builder:

  1. Get User Information:

    query = qb.generate("List all users with their email addresses")
    print(query)
  2. Count Records:

    query = qb.generate("How many products are in stock?")
    print(query)
  3. Join Tables:

    query = qb.generate("Show orders with user details")
    print(query)

These examples illustrate how natural language can easily translate into SQL commands, making database management more intuitive.

Contributing

We welcome contributions! If you want to improve this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push to your branch.
  5. Open a pull request.

Please ensure your code adheres to our coding standards and includes tests where applicable.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact

For any inquiries or feedback, please reach out via GitHub Issues.

Releases

To download the latest version of the PSQL Query Builder, visit our Releases section. Be sure to check for updates regularly.

Conclusion

The PSQL Query Builder simplifies database interactions by allowing users to generate SQL queries through natural language. With its AI capabilities and LangChain compatibility, it serves as a powerful tool for developers and data analysts alike.

Feel free to explore the repository, contribute, and help us improve this project. Your feedback is valuable to us!


Thank you for checking out the PSQL Query Builder! Happy querying!

About

Generate & Run PostgreSQL queries by only providing natural language inputs using AI | langchain compatible

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published