Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoder: Dump nested tables with their parent #275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bochecha
Copy link

@bochecha bochecha commented Jan 6, 2020

Currently, we first print all tables at the top level, then all nested
tables at the second level, etc…

As a result, this:

{
    'table1': {
        'foo': 1,
        'nested': {
            'bar': 2,
        },
    },
    'table2': {
        'baz': 3,
    },
}

… gets printed as:

[table1]
foo = 1

[table2]
baz = 3

[table1.nested]
bar = 2

With this commit, we print the nested tables with their parent, so the
same example from above will instead become:

[table1]
foo = 1

[table1.nested]
bar = 2

[table2]
baz = 3

Fixes #88

@bochecha
Copy link
Author

bochecha commented Jan 6, 2020

In #88, @sayanarijit suggests doing it with a new ordering option

It wasn't clear from that issue whether anything had been decided and that was the way to go, so I figured I wouldn't spend too much time on this before reaching an agreement on this.

As a result, take this pull request as a strawman for how the desired result can be achieved code-wise, and to restart the conversation on what the API should be. 🙂

(Personally, I feel that having the nested tables printed with their parents should be the default, and I can't find any reason not to want that at all)

Currently, we first print all tables at the top level, then all nested
tables at the second level, etc…

As a result, this:

    {
        'table1': {
            'foo': 1,
            'nested': {
                'bar': 2,
            },
        },
        'table2': {
            'baz': 3,
        },
    }

… gets printed as:

    [table1]
    foo = 1

    [table2]
    baz = 3

    [table1.nested]
    bar = 2

With this commit, we print the nested tables with their parent, so the
same example from above will instead become:

    [table1]
    foo = 1

    [table1.nested]
    bar = 2

    [table2]
    baz = 3

Fixes uiri#88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested tables should be written below their parent table
1 participant