NebulaGraph Python Client 5.0.0a1
Loading...
Searching...
No Matches
ResultSet Class Reference
+ Collaboration diagram for ResultSet:

Public Member Functions

 __init__ (self, Any response)
 
"ResultSet" raise_on_error (self)
 
Iterator[Record__iter__ (self)
 
 records (self)
 
str __str__ (self)
 
Iterable[Dict[str, Any]] as_primitive_by_row (self)
 
Dict[str, List[Any]] as_primitive_by_column (self)
 
"DataFrame" as_pandas_df (self)
 
Optional[str] as_ascii_table (self, Optional["Console"] console=None, str style="table", Optional[int] width=None, int min_width=8, Optional[int] max_width=None, int padding=1, bool collapse_padding=False)
 
Record one (self)
 
Optional[Recordone_or_none (self)
 
 print (self, str style="table", Optional[int] width=None, int min_width=8, Optional[int] max_width=None, int padding=1, bool collapse_padding=False)
 

Public Attributes

 result_table
 
 column_names
 
 size
 
 status_code
 
 status_message
 
 is_succeeded
 
 latency_us
 
 plan_desc
 
 extra_info
 

Static Public Attributes

List column_names [str]
 
Optional result_table [ResultTable]
 
str status_code
 
str status_message
 
int latency_us
 
PlanInfoNode plan_desc
 
int size
 
ExtraInfo extra_info
 

Protected Attributes

 _index
 

Detailed Description

Definition at line 85 of file result_set.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
Any  response 
)

Definition at line 95 of file result_set.py.

Member Function Documentation

◆ __iter__()

Iterator[Record] __iter__ (   self)

Definition at line 142 of file result_set.py.

◆ __str__()

str __str__ (   self)

Definition at line 151 of file result_set.py.

◆ as_ascii_table()

Optional[str] as_ascii_table (   self,
Optional["Console"]   console = None,
str   style = "table",
Optional[int]   width = None,
int   min_width = 8,
Optional[int]   max_width = None,
int   padding = 1,
bool   collapse_padding = False 
)
Print query results in a formatted table or row-by-row format. Return the string if console is not provided.

Args:
----
    console: rich.console.Console instance to use for printing. If None, a new instance will be created.
    style: Output style - either "table" (default) or "rows"
    width: Fixed width for all columns. If None, width will be auto-calculated
    min_width: Minimum width of columns when using table style
    max_width: Maximum width of columns. If None, no maximum is enforced
    padding: Number of spaces around cell contents in table style
    collapse_padding: Reduce padding when cell contents are too wide

Examples:
--------
    # Print as table (default)
    result.as_ascii_table()

    # Print as rows
    result.as_ascii_table(style="rows")

    # Customize table formatting
    result.as_ascii_table(width=20, max_width=30, padding=2)

Returns:
-------
    Optional[str]: Formatted representation of the results, or error message if query failed.
        If console is provided, the output will be printed to the console and None will be returned.

Definition at line 205 of file result_set.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ as_pandas_df()

"DataFrame" as_pandas_df (   self)
Convert result set to pandas DataFrame.

Returns
-------
    pandas.DataFrame: DataFrame containing the query results

Raises
------
    ImportError: If pandas is not installed

Definition at line 167 of file result_set.py.

+ Here is the call graph for this function:

◆ as_primitive_by_column()

Dict[str, List[Any]] as_primitive_by_column (   self)

Definition at line 160 of file result_set.py.

◆ as_primitive_by_row()

Iterable[Dict[str, Any]] as_primitive_by_row (   self)

Definition at line 156 of file result_set.py.

◆ one()

Record one (   self)

Definition at line 310 of file result_set.py.

◆ one_or_none()

Optional[Record] one_or_none (   self)

Definition at line 313 of file result_set.py.

◆ print()

print (   self,
str   style = "table",
Optional[int]   width = None,
int   min_width = 8,
Optional[int]   max_width = None,
int   padding = 1,
bool   collapse_padding = False 
)
Print the results directly to console with rich formatting.

Args are the same as as_ascii_table().

Definition at line 319 of file result_set.py.

+ Here is the call graph for this function:

◆ raise_on_error()

"ResultSet" raise_on_error (   self)

Definition at line 128 of file result_set.py.

◆ records()

records (   self)

Definition at line 145 of file result_set.py.

+ Here is the caller graph for this function:

Member Data Documentation

◆ _index

_index
protected

Definition at line 193 of file result_set.py.

◆ column_names [1/2]

List column_names [str]
static

Definition at line 86 of file result_set.py.

◆ column_names [2/2]

column_names

Definition at line 101 of file result_set.py.

◆ extra_info [1/2]

ExtraInfo extra_info
static

Definition at line 93 of file result_set.py.

◆ extra_info [2/2]

extra_info

Definition at line 118 of file result_set.py.

◆ is_succeeded

is_succeeded

Definition at line 112 of file result_set.py.

◆ latency_us [1/2]

int latency_us
static

Definition at line 90 of file result_set.py.

◆ latency_us [2/2]

latency_us

Definition at line 116 of file result_set.py.

◆ plan_desc [1/2]

PlanInfoNode plan_desc
static

Definition at line 91 of file result_set.py.

◆ plan_desc [2/2]

plan_desc

Definition at line 117 of file result_set.py.

◆ result_table [1/2]

Optional result_table [ResultTable]
static

Definition at line 87 of file result_set.py.

◆ result_table [2/2]

result_table

Definition at line 100 of file result_set.py.

◆ size [1/2]

int size
static

Definition at line 92 of file result_set.py.

◆ size [2/2]

size

Definition at line 102 of file result_set.py.

◆ status_code [1/2]

str status_code
static

Definition at line 88 of file result_set.py.

◆ status_code [2/2]

status_code

Definition at line 110 of file result_set.py.

◆ status_message [1/2]

str status_message
static

Definition at line 89 of file result_set.py.

◆ status_message [2/2]

status_message

Definition at line 111 of file result_set.py.


The documentation for this class was generated from the following file: