Skip to content

Casting of table rows #93

Open
Open
@Changaco

Description

@Changaco

When no Model subclass has been registered for a table, a row from that table contained in a query result isn't parsed at all, it's returned as a string. It would be nicer if the nested row was cast to the same type as the top-level row.

Current behavior:

>>> db.run("CREATE TABLE foo (bar int, baz text)")
>>> db.run("INSERT INTO foo VALUES (1, 'one')")
>>> db.one("SELECT true AS x, (SELECT foo FROM foo) AS foo", back_as='Row')
Row(x=True, foo='(1,foo)')

Desired behavior:

>>> db.one("SELECT true AS x, (SELECT foo FROM foo) AS foo", back_as='Row')
Row(x=True, foo=Row(bar=1, baz='foo'))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions