hasura / hasura/graphql-engine

Support: array type for Logical Model field (LogicalModelType)

Open
#9,842 0 comments 1 reaction 0 assignees View on GitHub
k/enhancement t/native-dbs
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

Currently, when you toggle "array" input (or set array as type) for respective Logical Model field, it gives you the following error
```
Arrays of scalar types are not currently implemented
```

### Describe the solution you'd like

Implementation of "array" type for [LogicalModelType](https://hasura.io/docs/latest/api-reference/syntax-defs/#logicalmodeltype)

### The metadata API ref for untracking and tracking LM
```json
{
"resource_version": 150,
"type": "bulk_atomic",
"args": [
{
"type": "postgres_untrack_logical_model",
"args": { "source": "default", "name": "album_tracks" }
},
{
"type": "postgres_track_logical_model",
"args": {
"source": "default",
"name": "album_tracks",
"fields": [
{
"name": "album_title",
"type": { "scalar": "varchar", "nullable": true }
},
{
"name": "track_name",
"type": { "array": { "scalar": "varchar", "nullable": true } }
}
]
}
}
]
}
```

### Screenshot

Screenshot 2023-08-22 at 5 15 59 PM

Contributor guide

Open the contributing guide

Research direction

Start by tracing LogicalModelType and the postgres_track_logical_model metadata operation described in the issue, including how the existing scalar field type is handled. Done means an array field such as {"array":{"scalar":"varchar","nullable":true}} can be tracked without the current scalar-array error and behaves correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres
Domain
api, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.