-
Notifications
You must be signed in to change notification settings - Fork 24
chore: add mysql tool #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
740a861
chore: add mysql tool
drpebcak 1126162
chore: single quote all the things
drpebcak d011883
chore: add additional credentials for username and hostname
drpebcak 4dc313d
fix: matching backtick
drpebcak eac822d
chore: update description to mention the cli used
drpebcak c7329c0
Merge branch 'main' into mysql
drpebcak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: mysql | ||
type: context | ||
description: Provides the ability to interact with mysql databases using the mysql cli. | ||
share tools: sys.exec | ||
share credentials: github.com/gptscript-ai/credential as cli.mysql.password with MYSQL_PWD as env and password as field and "Please enter your mysql user's password:" as message | ||
share credentials: github.com/gptscript-ai/credential as cli.mysql.username with MYSQL_USER as env and username as field and "Please enter your mysql username:" as message | ||
share credentials: github.com/gptscript-ai/credential as cli.mysql.hostname with MYSQL_HOST as env and hostname as field and "Please enter your mysql hostname/ip:" as message | ||
|
||
#!/bin/bash | ||
|
||
if ! command -v mysql; then | ||
echo 'The user does not have the mysql cli installed or it is not available on the PATH.' | ||
else | ||
echo 'The user has the mysql cli available. Use it to work with mysql.' | ||
echo 'Always execute mysql statements non-interactively from the CLI using one of two options:' | ||
echo '`-e "${SQL_QUERY}"` for single sql statements' | ||
echo '`< /path/to/script.sql` for longer scripts' | ||
echo 'The password is pre-set using the `$MYSQL_PWD` environment variable' | ||
echo 'The username is pre-set using the `$MYSQL_USER` environment variable. You can pass that to the cli using `-u ${MYSQL_USER}`' | ||
echo 'The hostname/ip is pre-set using the `$MYSQL_HOST` environment variable. You can pass that to the cli using `-h ${MYSQL_HOST}`' | ||
|
||
|
||
echo 'The following text is the help output of the mysql cli:' | ||
echo '```' | ||
mysql --help | ||
echo '```' | ||
fi | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.