Skip to content

Commit

Permalink
Add column restore_parameters to table azure_cosmosdb_account. Cl…
Browse files Browse the repository at this point in the history
…oses #593 (#594)

Co-authored-by: Ved misra <[email protected]>
  • Loading branch information
karanpopat and misraved authored Mar 29, 2023
1 parent 24d8a05 commit 6485e1a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions azure/table_azure_cosmosdb_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ func tableAzureCosmosDBAccount(_ context.Context) *plugin.Table {
Type: proto.ColumnType_JSON,
Transform: transform.FromField("DatabaseAccount.DatabaseAccountGetProperties.ReadLocations"),
},
{
Name: "restore_parameters",
Description: "Parameters to indicate the information about the restore.",
Type: proto.ColumnType_JSON,
Transform: transform.FromField("DatabaseAccount.DatabaseAccountGetProperties.RestoreParameters"),
},
{
Name: "virtual_network_rules",
Description: "A list of Virtual Network ACL rules configured for the Cosmos DB account.",
Expand Down
15 changes: 15 additions & 0 deletions docs/tables/azure_cosmosdb_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,18 @@ from
azure_cosmosdb_account,
jsonb_array_elements(private_endpoint_connections) as c;
```

### Get details of accounts restored from backup

```sql
select
name,
restore_parameters ->> 'restoreMode' as restore_mode,
restore_parameters ->> 'restoreSource' as restore_source,
d ->> 'databaseName' as restored_database_name,
c as restored_collection_name
from
azure_cosmosdb_account,
jsonb_array_elements(restore_parameters -> 'databasesToRestore') d,
jsonb_array_elements_text(d -> 'collectionNames') c;
```

0 comments on commit 6485e1a

Please sign in to comment.