

# AWS Glue Schema Registry system tables schema and example queries

## registries
<a name="schema-registry-system-tables-schema-registries"></a>

Full name: `"s3tablescatalog/aws-catalog"."glue"."registries"`. Partitioned by `bucket(32, id)`.

The `registries` system table contains one row for each registry in your account and Region.


| **Column** | **Type** | **Required** | **Description** | 
| --- | --- | --- | --- | 
| `id` | `string` | Yes | Unique identifier of the asset. | 
| `ingestion_time` | `timestamptz` | Yes | Time this asset record was ingested into the system table, in UTC. | 
| `update_time` | `timestamptz` | No | Time the asset was last updated in AWS Glue Data Catalog, in UTC. | 
| `schema_version` | `string` | Yes | Identifier of this system table's column layout. Changes when a column is added, removed, renamed, or retyped. | 
| `created_time` | `timestamptz` | No | Time the resource was created, in UTC. | 
| `name` | `string` | No | The user-provided business name for the asset. | 
| `description` | `string` | No | The user-provided business description for the asset. | 
| `resource_name` | `string` | Yes | The resource's technical name. | 
| `resource_description` | `string` | No | The resource's technical description. | 
| `status_enum` | `string` | No | The lifecycle status of the registry. Values: `AVAILABLE`, `FAILURE`, `DELETING`. | 

## schemas
<a name="schema-registry-system-tables-schema-schemas"></a>

Full name: `"s3tablescatalog/aws-catalog"."glue"."schemas"`. Partitioned by `bucket(32, id)`.

The `schemas` system table contains one row for each schema in your account and Region.


| **Column** | **Type** | **Required** | **Description** | 
| --- | --- | --- | --- | 
| `id` | `string` | Yes | Unique identifier of the asset. | 
| `ingestion_time` | `timestamptz` | Yes | Time this asset record was ingested into the system table, in UTC. | 
| `update_time` | `timestamptz` | No | Time the asset was last updated in AWS Glue Data Catalog, in UTC. | 
| `schema_version` | `string` | Yes | Identifier of this system table's column layout. Changes when a column is added, removed, renamed, or retyped. | 
| `created_time` | `timestamptz` | No | Time the resource was created, in UTC. | 
| `name` | `string` | No | The user-provided business name for the asset. | 
| `description` | `string` | No | The user-provided business description for the asset. | 
| `resource_name` | `string` | Yes | The resource's technical name. | 
| `resource_description` | `string` | No | The resource's technical description. | 
| `format_data_format_enum` | `string` | Yes | The data format of the schema definition. Values: `AVRO`, `JSON`, `PROTOBUF`. | 
| `namespaces` | `list<string>` | No | Every namespace declared in the schema definition, the root type's namespace first. On a schema version these are that version's namespaces; on a schema they are the latest version's. | 
| `compatibility_enum` | `string` | No | The compatibility mode that governs how new schema versions may evolve. Values: `NONE`, `DISABLED`, `BACKWARD`, `BACKWARD_ALL`, `FORWARD`, `FORWARD_ALL`, `FULL`, `FULL_ALL`. | 
| `latest_schema_version` | `long` | No | The version number of the latest schema version. | 
| `next_schema_version` | `long` | No | The version number of the next schema version to be assigned. | 
| `schema_checkpoint` | `long` | No | The version number of the schema checkpoint against which compatibility is evaluated. | 
| `status_enum` | `string` | No | The lifecycle status of the schema. Values: `AVAILABLE`, `PENDING`, `FAILURE`, `DELETING`. | 
| `belongs_to` | `string` | No | Fully qualified identifier of the container asset this asset is a member of. | 

## schema\_versions
<a name="schema-registry-system-tables-schema-schema-versions"></a>

Full name: `"s3tablescatalog/aws-catalog"."glue"."schema_versions"`. Partitioned by `bucket(32, id)`.

The `schema_versions` system table contains one row for each schema version in your account and Region.


| **Column** | **Type** | **Required** | **Description** | 
| --- | --- | --- | --- | 
| `id` | `string` | Yes | Unique identifier of the asset. | 
| `ingestion_time` | `timestamptz` | Yes | Time this asset record was ingested into the system table, in UTC. | 
| `update_time` | `timestamptz` | No | Time the asset was last updated in AWS Glue Data Catalog, in UTC. | 
| `schema_version` | `string` | Yes | Identifier of this system table's column layout. Changes when a column is added, removed, renamed, or retyped. | 
| `created_time` | `timestamptz` | No | Time the resource was created, in UTC. | 
| `name` | `string` | No | The user-provided business name for the asset. | 
| `description` | `string` | No | The user-provided business description for the asset. | 
| `resource_name` | `string` | Yes | The resource's technical name. | 
| `resource_description` | `string` | No | The resource's technical description. | 
| `schema_format_data_format_enum` | `string` | Yes | The data format of the schema definition. Values: `AVRO`, `JSON`, `PROTOBUF`. | 
| `schema_namespaces` | `list<string>` | No | Every namespace declared in the schema definition, the root type's namespace first. On a schema version these are that version's namespaces; on a schema they are the latest version's. | 
| `metadata` | `map<string,string>` | No | Customer-supplied metadata key-value pairs registered on this schema version, as returned by `QuerySchemaVersionMetadata`. | 
| `schema_definition` | `string` | No | The full schema definition text for this version. | 
| `schema_version_id` | `string` | Yes | The immutable, globally unique identifier assigned to this schema version by AWS Glue Schema Registry. | 
| `status_enum` | `string` | No | The lifecycle status of the schema version. Values: `AVAILABLE`, `PENDING`, `FAILURE`, `DELETING`. | 
| `version_number` | `long` | Yes | The version number of this schema version within its schema. | 
| `version_of` | `string` | No | Fully qualified identifier of the asset this asset is a version of. | 

## Example queries
<a name="schema-registry-system-tables-example-queries"></a>

*Schemas by data format and compatibility mode*

```sql
SELECT format_data_format_enum, compatibility_enum, count(*) AS schemas
FROM "s3tablescatalog/aws-catalog"."glue"."schemas"
GROUP BY 1, 2;
```

*Schemas with the most versions*

```sql
SELECT version_of, count(*) AS versions
FROM "s3tablescatalog/aws-catalog"."glue"."schema_versions"
GROUP BY 1
ORDER BY versions DESC
LIMIT 20;
```