i.e., it took me some time to figure out how to build a proper Nlist of strings to be passed to session_pool.execute_parameter(), I will wrap it as a utils later.
def prepare_subjs_param(subjs: Optional[List[str]]) -> dict:
"""Prepare parameters for query."""
if subjs is None:
return {}
from nebula3.common import ttypes
subjs_list = []
subjs_byte = ttypes.Value()
for subj in subjs:
if not isinstance(subj, str):
raise TypeError(f"Subject should be str, but got {type(subj).__name__}.")
subj_byte = ttypes.Value()
subj_byte.set_sVal(subj)
subjs_list.append(subj_byte)
subjs_nlist = ttypes.NList(values=subjs_list)
subjs_byte.set_lVal(subjs_nlist)
return {"subjs": subjs_byte}
i.e., it took me some time to figure out how to build a proper Nlist of strings to be passed to session_pool.execute_parameter(), I will wrap it as a utils later.