Table: planetscale_backup - Query PlanetScale Backup using SQL
PlanetScale Backup is a feature within PlanetScale that allows you to create, manage, and restore backups of your databases. It provides a reliable way to ensure the safety of your data, allowing you to recover your databases in the event of data loss. PlanetScale Backup helps you maintain the integrity and availability of your data by providing automated and manual backup options.
Table Usage Guide
The planetscale_backup
table provides insights into the backup details within PlanetScale. As a database administrator, explore backup-specific details through this table, including backup status, size, and related metadata. Utilize it to uncover information about backups, such as backup creation time, duration, and the associated database details.
Important Notes
- You must specify the
database_name
in thewhere
clause to query this table.
Examples
List all backups for a database
Explore all backups related to a specific database to maintain data integrity and ensure business continuity in case of data loss or corruption. This is particularly useful in disaster recovery scenarios or when performing routine data audits.
select *from planetscale_backupwhere database_name = 'test';
select *from planetscale_backupwhere database_name = 'test';
Get a specific backup
Discover the details of a specific backup within your main branch of the 'test' database, allowing you to gain insights into that particular backup's status and details. This is useful for assessing the health and success of your backup operations.
select *from planetscale_backupwhere database_name = 'test' and branch_name = 'main' and name = '2022.02.12 04:11:03';
select *from planetscale_backupwhere database_name = 'test' and branch_name = 'main' and name = '2022.02.12 04:11:03';
List all backups for all branches
Discover the segments that consist of all the backups for each branch in your database system. This is useful for maintaining data integrity and ensuring you have access to all necessary data in case of system failure or data loss.
select b.*from planetscale_database as d join planetscale_backup as b on d.name = b.database_name;
select b.*from planetscale_database as d join planetscale_backup as b on d.name = b.database_name;
Backups expiring in the next week
Discover the segments that are set to expire within the next week. This is useful in proactive planning to prevent any unexpected data loss.
select b.database_name, b.branch_name, b.name, b.expires_atfrom planetscale_database as d join planetscale_backup as b on d.name = b.database_namewhere b.expires_at < current_timestamp + interval '7 days'order by b.expires_at;
select b.database_name, b.branch_name, b.name, b.expires_atfrom planetscale_database as d join planetscale_backup as b on d.name = b.database_namewhere b.expires_at < datetime('now', '+7 days')order by b.expires_at;
Schema for planetscale_backup
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
branch_name | text | = | Name of the database branch. |
completed_at | timestamp with time zone | When the backup was completed. | |
created_at | timestamp with time zone | When the backup was created. | |
database_name | text | = | Name of the database. |
expires_at | timestamp with time zone | When the backup expires. | |
id | text | ID of the backup. | |
name | text | = | Name of the backup. |
organization_name | text | =, !=, ~~, ~~*, !~~, !~~* | Name of the organization. |
size | bigint | Size of the backup. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
started_at | timestamp with time zone | When the backup was started. | |
state | text | State of the backup. | |
updated_at | timestamp with time zone | When the backup was updated. |
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)" -- planetscale
You can pass the configuration to the command with the --config
argument:
steampipe_export_planetscale --config '<your_config>' planetscale_backup