Table: gcp_sql_database - Query Google Cloud SQL Databases using SQL
Google Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer relational databases on Google Cloud. It provides a cloud-based alternative to traditional on-premise databases, supporting both MySQL and PostgreSQL. Google Cloud SQL Databases offer high performance, scalability, and convenience.
Table Usage Guide
The gcp_sql_database
table provides insights into databases within Google Cloud SQL. As a database administrator or cloud engineer, you can explore database-specific details through this table, including the database name, instance, charset, and collation. Use it to manage and monitor your SQL databases efficiently, ensuring optimal performance and security.
Examples
Basic info
Explore the character set and collation configurations of your Google Cloud Platform SQL databases to ensure they align with your data encoding and sorting requirements. This can help maintain data integrity and prevent potential issues related to character representation and comparison.
select name, instance_name, charset, collationfrom gcp_sql_database;
select name, instance_name, charset, collationfrom gcp_sql_database;
Get the SQL Server version with which the database is to be made compatible
Determine the compatibility level of your database with different versions of SQL Server. This can be useful for planning version upgrades or ensuring backward compatibility with older versions.
select name, sql_server_database_compatibility_levelfrom gcp_sql_database;
select name, sql_server_database_compatibility_levelfrom gcp_sql_database;
Count of databases per instance
Analyze the settings to understand the distribution of databases across different instances. This can help in assessing the load distribution and managing resources more effectively.
select instance_name, count(*) as database_countfrom gcp_sql_databasegroup by instance_name;
select instance_name, count(*) as database_countfrom gcp_sql_databasegroup by instance_name;
Query examples
Schema for gcp_sql_database
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
akas | jsonb | Array of globally unique identifier strings (also known as) for the resource. | |
charset | text | Specifies the MySQL charset value. | |
collation | text | Specifies the MySQL collation value. | |
instance_name | text | = | The name of the Cloud SQL instance. |
kind | text | The type of the resource. | |
location | text | The GCP multi-region, region, or zone in which the resource is located. | |
name | text | = | A friendly name that identifies the resource. |
project | text | =, !=, ~~, ~~*, !~~, !~~* | The GCP Project in which the resource is located. |
self_link | text | The server-defined URL for the resource. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
sql_server_database_compatibility_level | bigint | The version of SQL Server with which the database is to be made compatible. | |
sql_server_database_recovery_model | text | The recovery model of a SQL Server database. | |
title | text | Title of the resource. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- gcp
You can pass the configuration to the command with the --config
argument:
steampipe_export_gcp --config '<your_config>' gcp_sql_database