|
2 | 2 |
|
3 | 3 | This Gemini CLI extension provides a set of tools to interact with [PostgreSQL](https://www.postgresql.org/docs/) instances. It allows you to manage your databases, execute queries, and explore schemas directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts. |
4 | 4 |
|
5 | | -## Features |
| 5 | +## Why Use the Postgres Extension? |
6 | 6 |
|
7 | | -* **Integrated with Gemini CLI:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment, making security an accessible part of your workflow. |
8 | | -* **Connect to PostgreSQL:** Securely connect to your PostgreSQL instances. |
9 | | -* **Explore Database Schema:** List databases, tables, views, and schemas. |
10 | | -* **Query your Database:** Execute SQL queries against your database. |
11 | | - |
12 | | -## Supported Tools |
13 | | - |
14 | | -* list-tables: Use this tool to list tables and descriptions. |
15 | | -* execute-sql: Use this tool to execute any SQL statement. |
| 7 | +* **Natural Language Management:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English. |
| 8 | +* **Seamless Workflow:** Stay in your CLI. No need to constantly switch contexts to the GCP console for common database tasks. |
| 9 | +* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas. |
16 | 10 |
|
17 | 11 | ## Prerequisites |
18 | 12 |
|
19 | 13 | Before you begin, ensure you have the following: |
20 | 14 |
|
21 | 15 | * [Gemini CLI](https://github.com/google-gemini/gemini-cli) installed. |
22 | 16 | * A running PostgreSQL instance. |
| 17 | +* User are granted database-level permissions to execute queries. |
23 | 18 |
|
24 | 19 | ## Installation |
25 | 20 |
|
26 | | -To install the extension, use the `gemini extensions install` command: |
| 21 | +To install the extension, use the command: |
27 | 22 |
|
28 | 23 | ```bash |
29 | | -gemini extensions install github.com/gemini-cli-extensions/postgresql.git |
| 24 | +gemini extensions install github.com/gemini-cli-extensions/postgres |
30 | 25 | ``` |
31 | 26 |
|
32 | 27 | ## Configuration |
33 | 28 |
|
| 29 | +Set the following environment variables before starting the Gemini CLI: |
| 30 | + |
34 | 31 | * `POSTGRES_HOST`: The hostname or IP address of the PostgreSQL server. |
35 | 32 | * `POSTGRES_PORT`: The port number of the PostgreSQL server. |
36 | 33 | * `POSTGRES_DATABASE`: The name of the database to connect to. |
37 | 34 | * `POSTGRES_USER`: The username for authentication. |
38 | 35 | * `POSTGRES_PASSWORD`: The password for authentication. |
39 | 36 |
|
| 37 | +## Usage Examples |
40 | 38 |
|
41 | | -## Usage |
| 39 | +Interact with Postgres using natural language right from your IDE: |
42 | 40 |
|
43 | | -* Explore Schemas and Data |
44 | | -* Generate code |
| 41 | +* **Explore Schemas and Data:** |
| 42 | + * "Show me all tables in the 'orders' database." |
| 43 | + * "What are the columns in the 'products' table?" |
| 44 | + * "How many orders were placed in the last 30 days, and what were the top 5 most purchased items?" |
| 45 | + |
| 46 | +* **Generate Code:** |
| 47 | + * "Generate a Python dataclass to represent the 'customers' table." |
| 48 | + |
| 49 | +## Supported Tools |
45 | 50 |
|
| 51 | +* `list_tables`: Lists tables in the database. |
| 52 | +* `execute_sql`: Executes a SQL query. |
46 | 53 |
|
47 | | -## Security |
| 54 | +## Additional Extensions |
48 | 55 |
|
49 | | -This extension executes commands against your PostgreSQL database. Always review the generated SQL queries before execution, especially for write operations. |
| 56 | +Find additional extensions to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions). |
50 | 57 |
|
51 | | -## Disclaimer |
| 58 | +## Troubleshooting |
52 | 59 |
|
53 | | -This is not an officially supported Google product. This extension is under active development, and breaking changes may be introduced. |
| 60 | +* "cannot execute binary file": Ensure the correct binary for your OS/Architecture has been downloaded. See [Installing the server](https://googleapis.github.io/genai-toolbox/getting-started/introduction/#installing-the-server) for more information. |
0 commit comments