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

Casting of table rows #93

Open
Changaco opened this issue Dec 20, 2019 · 0 comments
Open

Casting of table rows #93

Changaco opened this issue Dec 20, 2019 · 0 comments

Comments

@Changaco
Copy link
Member

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'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant