Query-MySQL Op 🚀
The Query MySQL Op is designed to allow users to conveniently make queries to a MySQL database.
To run this or any other Op, install The Ops Platform.
You can find information on how to run and build Ops via The Ops Platform Documentation.
In Slack, you can run this Op with:
/ops run cto.ai/query-mysql
Alternatively, you can run this Op in the command line with:
ops run @cto.ai/query-mysql
The Op begins with a series of prompts asking for the necessary credentials for accessing a desired database. These credentials can be fully pre-set with the Ops Platform Secrets functionality.
Once the credentials have been provided, the Op with automatically attempt to make a connection. Assuming a successful connection, the user will be presented with the following options.
Make Query: The user can enter a valid SQL query and will print the requested response.
Change Fetch Amount: When making queries, the fetch amount will determine how much of the response is printed. This can be toggled between one line or all available data. Printing all lines when running the Op in Slack is NOT recommended.
Table List: The Op will print a list of tables available in the database.
Column List: The Op will prompt the user for a table name, and print the columns names from that table
Finish: The above four options will loop until this option is selected
When submitting issues or requesting help, be sure to also include the version information. To get your Ops version run:
Limitations & Future Improvements
Currently, there is no option to save any outputs directly through the Op. This is due to the limited permissions the Ops Slack app requests, but may change in the future. Additionally, table formatting is also planned for future updates.
See the Contributing Docs for more information.
- Ivan Lan via GitHub