turbot/planetscale
steampipe plugin install planetscale

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 the where 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_backup
where
database_name = 'test';
select
*
from
planetscale_backup
where
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_backup
where
database_name = 'test'
and branch_name = 'main'
and name = '2022.02.12 04:11:03';
select
*
from
planetscale_backup
where
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_at
from
planetscale_database as d
join planetscale_backup as b on d.name = b.database_name
where
b.expires_at < current_timestamp + interval '7 days'
order by
b.expires_at;
select
b.database_name,
b.branch_name,
b.name,
b.expires_at
from
planetscale_database as d
join planetscale_backup as b on d.name = b.database_name
where
b.expires_at < datetime('now', '+7 days')
order by
b.expires_at;

Schema for planetscale_backup

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
branch_nametext=Name of the database branch.
completed_attimestamp with time zoneWhen the backup was completed.
created_attimestamp with time zoneWhen the backup was created.
database_nametext=Name of the database.
expires_attimestamp with time zoneWhen the backup expires.
idtextID of the backup.
nametext=Name of the backup.
organization_nametext=, !=, ~~, ~~*, !~~, !~~*Name of the organization.
sizebigintSize of the backup.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
started_attimestamp with time zoneWhen the backup was started.
statetextState of the backup.
updated_attimestamp with time zoneWhen 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