aktonay/skillz / skills/cloud/cloud-sql-basics
cloud-sql-basics
VerifiedThis file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source MySQL instance, the resulting resource is a Cloud SQL for MySQL instance that Google Cloud manages. Cloud SQL handles backups, high availability, and secure connectivity for relational database workloads.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 3.5 KB |
| references/cli-usage.md | markdown | 1.5 KB |
| references/client-library-usage.md | markdown | 2.9 KB |
| references/core-concepts.md | markdown | 2.0 KB |
| references/iac-usage.md | markdown | 1.2 KB |
| references/iam-security.md | markdown | 2.9 KB |
| references/mcp-usage.md | markdown | 2.4 KB |
references/client-library-usage.md
View on GitHub# Cloud SQL Client Libraries
Google Cloud provides client libraries and connectors to simplify connecting to
Cloud SQL from various programming languages.
## Getting Started
Ensure you have the latest version of the Google Cloud SDK installed and
authenticated.
[Install Google Cloud SDK](https://cloud.google.com/sdk/docs/install)
### Language Connectors
The Cloud SQL Language Connectors (Python, Java, Go, Node.js) provide a secure
way to connect to the Cloud SQL instance without managing IP allowlists or SSL
certificates.
#### Python
- **Installation for a Cloud SQL for PostgreSQL instance:**
```bash
pip install "cloud-sql-python-connector[pg8000]"
```
- **Usage Example:**
```python
from google.cloud.sql.connector import Connector
connector = Connector()
def getconn():
conn = connector.connect(
"project:region:instance",
"pg8000",
user="my-user",
password="my-password",
db="my-db"
)
return conn
```
#### Java
- **Maven Dependencies:**
The recommended method is to use the Cloud SQL JDBC Socket Factory. Add the
BOM to your `<dependencyManagement>` section:
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>jdbc-socket-factory-bom</artifactId>
<version>1.18.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
```
Then add dependencies for your database:
* **PostgreSQL:**
```xml
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.3</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>postgres-socket-factory</artifactId>
</dependency>
</dependencies>
```
* **MySQL:**
```xml
<dependencies>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.33</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-8</artifactId>
</dependency>
</dependencies>
```
#### Node.js (TypeScript)
- **Installation:**
```bash
npm install @google-cloud/cloud-sql-connector
```
#### Go
- **Installation:**
```bash
go get cloud.google.com/go/cloudsqlconn
```
## Cloud SQL Admin API
To manage Cloud SQL resources (e.g., list instances) programmatically, use the
`sqladmin` libraries.
- [Cloud SQL Admin API Overview](https://docs.cloud.google.com/sql/docs/mysql/admin-api)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |