microsoft / microsoft/vscode-powerquery-sdk

Output Format Suggestion - Table Rows vs. Records

Open
#152 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
92
Forks
23
PR merge metrics
No merged PRs in 30d

Description

The format used for table rows differs between when a set of rows is returned (i.e. as a table) vs. when a single row is returned (i.e. as a record).

For symmetry (and so simplicity of parsing), what would be the chances of these two formats aligning, so that the same format is used for a row regardless of whether it is in a table or returned as a record?

Details

When a table is output, a JSON array is returned. Each row is represented as a JSON object, with the column names mapping to property names and column values to property values.

// #table({"Col1", "Col2"}, {{"ABC", 123}, {"DEF", 456}}): 
"Output": [
    {
        "Col1": "ABC",
        "Col2": 123
    },
    {
        "Col1": "DEF",
        "Col2": 456
    }
],
"RowCount": 2

When a single row from a table is output (a.k.a. a record), instead of a single JSON object being returned for the row (as is used above for rows), the output format changes to a JSON array with each record field as a separate key-value style JSON object:

// Table.First(#table({"Col1", "Col2"}, {{"ABC", 123}, {"DEF", 456}}))
"Output": [
    {
        "Name": "Col1",
        "Value": "ABC"
    },
    {
        "Name": "Col2",
        "Value": 123
    }
],
"RowCount": 2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by tracing how the SDK serializes table results and single records, using the two JSON examples as the current behavior. Confirm the desired common row representation and document or test the agreed output before changing implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.