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

dx: ResultSet.as_premitive() #348

Merged
merged 1 commit into from
May 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions nebula3/data/ResultSet.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ def rows(self):
return []
return self._data_set_wrapper.get_rows()

def as_primitive(self):
"""Convert result set to list of dict with primitive values per row

:return: list<dict>
"""
return [
{
col_key: self.row_values(row_index)[col_index].cast_primitive()
for col_index, col_key in enumerate(self.keys())
}
for row_index in range(self.row_size())
]

def dict_for_vis(self):
"""Convert result set to a dictionary format suitable for visualization.

Expand Down
Loading