Problem
Currently, JSON/JSONB metadata discovery requires reading JSON/JSONB values separately from the database after ingestion.
This can result in an additional database query even though the JSON/JSONB data may already be available during the SLayer ingestion process.
Requirement
Support discovering metadata from JSON/JSONB values that are already available during ingestion.
The JSON/JSONB structure is not known in advance and may vary between rows.
For example:
- A table may contain 2–3 JSONB columns.
- Each JSONB column may have a different structure.
- Different rows within the same JSONB column may also contain different structures.
- JSON objects may be nested to multiple levels.
Expected Behavior
During ingestion, when a JSON/JSONB value is available, the metadata discovery process should be able to:
- Traverse the JSON/JSONB structure recursively.
- Discover nested field paths.
- Infer the appropriate data type for scalar values.
- Handle different structures across multiple rows.
- Merge discovered fields/types for the corresponding JSONB column.
- Generate the appropriate SLayer metadata.
- Avoid an additional database query solely for JSON/JSONB metadata discovery.
Example
Given:
{
"name": "John",
"address": {
"city": "Kochi",
"state": "Kerala"
},
"orders": [
{
"id": 101,
"amount": 500
}
]
}
The discovery process should be able to identify paths such as:
name
address
address.city
address.state
orders
orders.id
orders.amount
Current Implementation
There is already a separate JSON processor that performs recursive JSON traversal, type inference, type merging, sensitive-field filtering, and SLayer metadata generation.
The proposed change is to reuse this existing discovery logic and provide it with JSON/JSONB values already obtained during SLayer ingestion instead of querying the database again.
Benefit
This would:
- Avoid unnecessary database reads.
- Reduce database load.
- Reuse JSON/JSONB data already available during ingestion.
- Support arbitrary and changing JSON structures.
- Keep JSON/JSONB metadata generation integrated with the ingestion flow.
Problem
Currently, JSON/JSONB metadata discovery requires reading JSON/JSONB values separately from the database after ingestion.
This can result in an additional database query even though the JSON/JSONB data may already be available during the SLayer ingestion process.
Requirement
Support discovering metadata from JSON/JSONB values that are already available during ingestion.
The JSON/JSONB structure is not known in advance and may vary between rows.
For example:
Expected Behavior
During ingestion, when a JSON/JSONB value is available, the metadata discovery process should be able to:
Example
Given:
{ "name": "John", "address": { "city": "Kochi", "state": "Kerala" }, "orders": [ { "id": 101, "amount": 500 } ] }The discovery process should be able to identify paths such as:
Current Implementation
There is already a separate JSON processor that performs recursive JSON traversal, type inference, type merging, sensitive-field filtering, and SLayer metadata generation.
The proposed change is to reuse this existing discovery logic and provide it with JSON/JSONB values already obtained during SLayer ingestion instead of querying the database again.
Benefit
This would: