{"id":18725197,"url":"https://github.com/vesoft-inc/nebula-python","last_synced_at":"2026-04-08T08:02:30.859Z","repository":{"id":37677956,"uuid":"214361893","full_name":"vesoft-inc/nebula-python","owner":"vesoft-inc","description":"Client API of Nebula Graph in Python","archived":false,"fork":false,"pushed_at":"2026-03-17T02:37:57.000Z","size":26868,"stargazers_count":234,"open_issues_count":36,"forks_count":83,"subscribers_count":30,"default_branch":"master","last_synced_at":"2026-03-30T13:26:05.514Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vesoft-inc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSES/Apache-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-10-11T06:37:53.000Z","updated_at":"2026-03-21T01:35:54.000Z","dependencies_parsed_at":"2023-02-19T15:31:46.914Z","dependency_job_id":"4fcb60ff-08ff-438d-973f-3e43235a3e22","html_url":"https://github.com/vesoft-inc/nebula-python","commit_stats":{"total_commits":150,"total_committers":31,"mean_commits":4.838709677419355,"dds":0.56,"last_synced_commit":"e96af4f9d92c21533232684cc6e98a58a27c9b2e"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/vesoft-inc/nebula-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vesoft-inc","download_url":"https://codeload.github.com/vesoft-inc/nebula-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vesoft-inc%2Fnebula-python/sbom","scorecard":{"id":919306,"data":{"date":"2025-08-11","repo":{"name":"github.com/vesoft-inc/nebula-python","commit":"ba345a6e26e480201c7abe6314687f744b12bb1b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":10,"reason":"all changesets reviewed","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/check_label.yml:1","Warn: no topLevel permission defined: .github/workflows/deploy_release.yaml:1","Warn: no topLevel permission defined: .github/workflows/doxygen.yml:1","Warn: no topLevel permission defined: .github/workflows/run_test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSES/Apache-2.0.txt:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSES/Apache-2.0.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/check_label.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/check_label.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/deploy_release.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/deploy_release.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/deploy_release.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/deploy_release.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/doxygen.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/doxygen.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/doxygen.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/doxygen.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pull-request-links.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/pull-request-links.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run_test.yaml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run_test.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/run_test.yaml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run_test.yaml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/run_test.yaml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/run_test.yaml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/run_test.yaml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/run_test.yaml:104: update your workflow using https://app.stepsecurity.io/secureworkflow/vesoft-inc/nebula-python/run_test.yaml/master?enable=pin","Warn: pipCommand not pinned by hash: docs/build.sh:1","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:37","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:40","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:41","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:75","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:76","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:110","Warn: pipCommand not pinned by hash: .github/workflows/run_test.yaml:111","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   8 third-party GitHubAction dependencies pinned","Info:   0 out of   8 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":3,"reason":"7 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2024-48 / GHSA-fj7x-q9j7-g6q6","Warn: Project is vulnerable to: PYSEC-2024-230 / GHSA-248v-346w-9cwc","Warn: Project is vulnerable to: GHSA-xqrq-4mgf-ff32","Warn: Project is vulnerable to: GHSA-vqfr-h8mv-ghfj","Warn: Project is vulnerable to: GHSA-h8pj-cxx2-jfg2","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-jfmj-5v4g-7637"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-25T00:03:49.781Z","repository_id":37677956,"created_at":"2025-08-25T00:03:49.781Z","updated_at":"2025-08-25T00:03:49.781Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31296634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T04:33:12.332Z","status":"ssl_error","status_checked_at":"2026-04-02T04:31:13.162Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-07T14:09:27.877Z","updated_at":"2026-04-08T08:02:30.840Z","avatar_url":"https://github.com/vesoft-inc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NebulaGraph Python Client\n\n[![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)\n[![pypi-version](https://img.shields.io/pypi/v/nebula3-python)](https://pypi.org/project/nebula3-python/)\n[![python-version](https://img.shields.io/badge/python-3.6.2+%20|%203.7%20|%203.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue)](https://www.python.org/)\n\n## Getting Started\n\n**Note**: Ensure you are using the correct version, refer to the [Capability Matrix](#Compatibility-Matrix) for how the Python client version corresponds to the NebulaGraph Database version.\n\n### Accessing NebulaGraph\n\n- [Get Started Notebook](example/get_started.ipynb) - A Jupyter Notebook to get started with NebulaGraph Python client, with latest features and examples.\n\n- For **first-time** trying out Python client, go through [Quick Example: Connecting to GraphD Using Graph Client](#quick-example-connecting-to-graphd-using-graph-client).\n\n- If your Graph Application is a **Web Service** dedicated to one Graph Space, go with Singleton of **Session Pool**, check [Using the Session Pool: A Guide](#using-the-session-pool-a-guide).\n\n- If you're building Graph Analysis Tools(Scan instead of Query), you may want to use the **Storage Client** to scan vertices and edges, see [Quick Example: Using Storage Client to Scan Vertices and Edges](#quick-example-using-storage-client-to-scan-vertices-and-edges).\n\n- For parameterized query, see [Example: Server-Side Evaluated Parameters](#example-server-side-evaluated-parameters).\n\n### Handling Query Results\n\n- On how to form a query result into a **Pandas DataFrame**, see [Example: Fetching Query Results into a Pandas DataFrame](#example-fetching-query-results-into-a-pandas-dataframe).\n\n- On how to render/visualize the query result, see [Example: Extracting Edge and Vertex Lists from Query Results](#example-extracting-edge-and-vertex-lists-from-query-results), it demonstrates how to extract lists of edges and vertices from any query result by utilizing the `ResultSet.dict_for_vis()` method.\n\n- On how to get rows of dict/JSON structure with primitive types, see [Example: Retrieve Primitive Typed Results](#example-retrieve-primitive-typed-results).\n\n### Jupyter Notebook Integration\n\n[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/wey-gu/jupyter_nebulagraph/blob/main/docs/get_started.ipynb)\n\n\nIf you are about to access NebulaGraph within Jupyter Notebook, you may want to use the [NebulaGraph Jupyter Extension](https://pypi.org/project/jupyter-nebulagraph/), which provides a more interactive way to access NebulaGraph. See also this on Google Colab: [NebulaGraph on Google Colab](https://colab.research.google.com/github/wey-gu/jupyter_nebulagraph/blob/main/docs/get_started.ipynb).\n\n## Obtaining nebula3-python\n\n### Method 1: Installation via pip\n\n```python\n# for v3.x\npip install nebula3-python==$version\n# for v2.x\npip install nebula2-python==$version\n```\n\n### Method 2: Installation via source\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand\u003c/summary\u003e\n\n- Clone from GitHub\n\n```bash\ngit clone https://github.com/vesoft-inc/nebula-python.git\ncd nebula-python\n```\n\n- Install from source\n\n\u003e For python version \u003e= 3.7.0\n\n```bash\npip install .\n```\n\n\u003e For python version \u003e= 3.6.2, \u003c 3.7.0\n\n```bash\npython3 setup.py install\n```\n\n\u003c/details\u003e\n\n## Quick Example: Connecting to GraphD Using Graph Client\n\n```python\nfrom nebula3.gclient.net import ConnectionPool\nfrom nebula3.Config import Config\n\n# define a config\nconfig = Config()\nconfig.max_connection_pool_size = 10\n# init connection pool\nconnection_pool = ConnectionPool()\n# if the given servers are ok, return true, else return false\nok = connection_pool.init([('127.0.0.1', 9669)], config)\n\n# option 1 control the connection release yourself\n# get session from the pool\nsession = connection_pool.get_session('root', 'nebula')\n\n# select space\nsession.execute('USE basketballplayer')\n\n# show tags\nresult = session.execute('SHOW TAGS')\nprint(result)\n\n# release session\nsession.release()\n\n# option 2 with session_context, session will be released automatically\nwith connection_pool.session_context('root', 'nebula') as session:\n    session.execute('USE basketballplayer')\n    result = session.execute('SHOW TAGS')\n    print(result)\n\n# close the pool\nconnection_pool.close()\n```\n\n## Using the Session Pool: A Guide\n\nThe session pool is a collection of sessions that are managed by the pool. It is designed to improve the efficiency of session management and to reduce the overhead of session creation and destruction.\n\nSession Pool comes with the following assumptions:\n\n1. A space must already exist in the database prior to the initialization of the session pool.\n2. Each session pool is associated with a single user and a single space to ensure consistent access control for the user. For instance, a user may possess different access permissions across various spaces. To execute queries in multiple spaces, consider utilizing several session pools.\n3. Whenever `sessionPool.execute()` is invoked, the session executes the query within the space specified in the session pool configuration.\n4. It is imperative to avoid executing commands through the session pool that would alter passwords or remove users.\n\nFor more details, see [SessionPoolExample.py](example/SessionPoolExample.py).\n\n## Example: Server-Side Evaluated Parameters\n\nTo enable parameterization of the query, refer to the following example:\n\n\u003e Note: Not all tokens of a query can be parameterized. You can quickly verify it via iPython or Nebula-Console in an interactive way.\n\n```python\nparams = {\n    \"p1\": 3,\n    \"p2\": True,\n    \"p3\": \"Bob\",\n    \"ids\": [\"player100\", \"player101\"], # second query\n}\n\nresp = client.execute_py(\n    \"RETURN abs($p1)+3 AS col1, (toBoolean($p2) and false) AS col2, toLower($p3)+1 AS col3\",\n    params,\n)\nresp = client.execute_py(\n    \"MATCH (v) WHERE id(v) in $ids RETURN id(v) AS vertex_id\",\n    params,\n)\n```\n\nFor further information, consult [Params.py](example/Params.py).\n\n\n## Example: Extracting Edge and Vertex Lists from Query Results\n\nFor graph visualization purposes, the following code snippet demonstrates how to effortlessly extract lists of edges and vertices from any query result by utilizing the `ResultSet.dict_for_vis()` method.\n\n```python\nresult = session.execute(\n    'GET SUBGRAPH WITH PROP 2 STEPS FROM \"player101\" YIELD VERTICES AS nodes, EDGES AS relationships;')\n\ndata_for_vis = result.dict_for_vis()\n```\n\nThen, we could pass the `data_for_vis` to a front-end visualization library such as `vis.js`, `d3.js` or Apache ECharts. There is an example of Apache ECharts in [exapmple/apache_echarts.html](example/apache_echarts.html).\n\nThe dict/JSON structure with `dict_for_vis()` is as follows:\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\n```json\n{\n    'nodes': [\n        {\n            'id': 'player100',\n            'labels': ['player'],\n            'props': {\n                'name': 'Tim Duncan',\n                'age': '42',\n                'id': 'player100'\n            }\n        },\n        {\n            'id': 'player101',\n            'labels': ['player'],\n            'props': {\n                'age': '36',\n                'name': 'Tony Parker',\n                'id': 'player101'\n            }\n        }\n    ],\n    'edges': [\n        {\n            'src': 'player100',\n            'dst': 'player101',\n            'name': 'follow',\n            'props': {\n                'degree': '95'\n            }\n        }\n    ],\n    'nodes_dict': {\n        'player100': {\n            'id': 'player100',\n            'labels': ['player'],\n            'props': {\n                'name': 'Tim Duncan',\n                'age': '42',\n                'id': 'player100'\n            }\n        },\n        'player101': {\n            'id': 'player101',\n            'labels': ['player'],\n            'props': {\n                'age': '36',\n                'name': 'Tony Parker',\n                'id': 'player101'\n            }\n        }\n    },\n    'edges_dict': {\n        ('player100', 'player101', 0, 'follow'): {\n            'src': 'player100',\n            'dst': 'player101',\n            'name': 'follow',\n            'props': {\n                'degree': '95'\n            }\n        }\n    },\n    'nodes_count': 2,\n    'edges_count': 1\n}\n```\n\n\u003c/details\u003e\n\n## Example: Retrieve Primitive Typed Results\n\nThe executed result is typed as `ResultSet`, and you can inspect its structure using `dir()`.\n\nFor each data cell in the `ResultSet`, you can use `.cast()` to retrieve raw wrapped data (with sugar) such as a Vertex (Node), Edge (Relationship), Path, Value (Int, Float, etc.). Alternatively, you can use `.cast_primitive()` to obtain values in primitive types like dict, int, or float, depending on your needs.\n\nFor more details, refer to [FromResp.py](example/FromResp.py).\n\nAdditionally, `ResultSet.as_primitive()` provides a convenient method to convert the result set into a list of dictionaries (similar to JSONL format) containing primitive values for each row.\n\n```python\nresult = session.execute('\u003cyour query\u003e')\n\nresult_dict = result.as_primitive()\nprint(result_dict)\n```\n\n## Example: Fetching Query Results into a Pandas DataFrame\n\n\u003e For `nebula3-python\u003e=3.6.0`:\n\nAssuming you have pandas installed, you can use the following code to fetch query results into a pandas DataFrame:\n\n```bash\npip3 install pandas\n```\n\n```python\nresult = session.execute('\u003cyour query\u003e')\ndf = result.as_data_frame()\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eFor `nebula3-python\u003c3.6.0`:\u003c/summary\u003e\n\n```python\nfrom nebula3.gclient.net import ConnectionPool\nfrom nebula3.Config import Config\nimport pandas as pd\nfrom typing import Dict\nfrom nebula3.data.ResultSet import ResultSet\n\ndef result_to_df(result: ResultSet) -\u003e pd.DataFrame:\n    \"\"\"\n    build list for each column, and transform to dataframe\n    \"\"\"\n    assert result.is_succeeded()\n    columns = result.keys()\n    d: Dict[str, list] = {}\n    for col_num in range(result.col_size()):\n        col_name = columns[col_num]\n        col_list = result.column_values(col_name)\n        d[col_name] = [x.cast() for x in col_list]\n    return pd.DataFrame(d)\n\n# define a config\nconfig = Config()\n\n# init connection pool\nconnection_pool = ConnectionPool()\n\n# if the given servers are ok, return true, else return false\nok = connection_pool.init([('127.0.0.1', 9669)], config)\n\n# option 2 with session_context, session will be released automatically\nwith connection_pool.session_context('root', 'nebula') as session:\n    session.execute('USE \u003cyour graph space\u003e')\n    result = session.execute('\u003cyour query\u003e')\n    df = result_to_df(result)\n    print(df)\n\n# close the pool\nconnection_pool.close()\n\n```\n\n\u003c/details\u003e\n\n## Quick Example: Using Storage Client to Scan Vertices and Edges\n\nStorage Client enables you to scan vertices and edges from the storage service instead of the graph service w/ nGQL/Cypher. This is useful when you need to scan a large amount of data.\n\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand\u003c/summary\u003e\n\nYou should make sure the scan client can connect to the address of storage which see from `SHOW HOSTS`\n\n```python\nfrom nebula3.mclient import MetaCache, HostAddr\nfrom nebula3.sclient.GraphStorageClient import GraphStorageClient\n\n# the metad servers's address\nmeta_cache = MetaCache([('172.28.1.1', 9559),\n                        ('172.28.1.2', 9559),\n                        ('172.28.1.3', 9559)],\n                       50000)\n\n# option 1 metad usually discover the storage address automatically\ngraph_storage_client = GraphStorageClient(meta_cache)\n\n# option 2 manually specify the storage address\nstorage_addrs = [HostAddr(host='172.28.1.4', port=9779),\n                 HostAddr(host='172.28.1.5', port=9779),\n                 HostAddr(host='172.28.1.6', port=9779)]\ngraph_storage_client = GraphStorageClient(meta_cache, storage_addrs)\n\nresp = graph_storage_client.scan_vertex(\n        space_name='ScanSpace',\n        tag_name='person')\nwhile resp.has_next():\n    result = resp.next()\n    for vertex_data in result:\n        print(vertex_data)\n\nresp = graph_storage_client.scan_edge(\n    space_name='ScanSpace',\n    edge_name='friend')\nwhile resp.has_next():\n    result = resp.next()\n    for edge_data in result:\n        print(edge_data)\n```\n\n\u003c/details\u003e\n\nSee [ScanVertexEdgeExample.py](example/ScanVertexEdgeExample.py) for more details.\n\n## Compatibility Matrix\n\n| Nebula-Python Version | Compatible NebulaGraph Versions | Notes                                                      |\n| --------------------- | ------------------------------- | ---------------------------------------------------------- |\n| 3.8.3                 | 3.x                             | Highly recommended. Latest release for NebulaGraph 3.x series. |\n| master                | master                          | Includes recent changes. Not yet released.                 |\n| 3.0.0 ~ 3.5.1         | 3.x                             | Compatible with any released version within the NebulaGraph 3.x series. |\n| 2.6.0                 | 2.6.0, 2.6.1                    |                                                            |\n| 2.5.0                 | 2.5.0                           |                                                            |\n| 2.0.0                 | 2.0.0, 2.0.1                    |                                                            |\n| 1.0                   | 1.x                             |                                                            |\n\n## Directory Structure Overview\n\n```text\n.\n└──nebula-python\n    │\n    ├── nebula3                               // client source code\n    │   ├── fbthrift                          // the RPC code generated from thrift protocol\n    │   ├── common\n    │   ├── data\n    │   ├── graph\n    │   ├── meta\n    │   ├── net                               // the net code for graph client\n    │   ├── storage                           // the storage client code\n    │   ├── Config.py                         // the pool config\n    │   └── Exception.py                      // the exceptions\n    │\n    ├── examples\n    │   ├── FormatResp.py                     // the format response example\n    │   ├── SessionPoolExample.py             // the session pool example\n    │   ├── GraphClientMultiThreadExample.py  // the multi thread example\n    │   ├── GraphClientSimpleExample.py       // the simple example\n    │   └── ScanVertexEdgeExample.py          // the scan vertex and edge example(storage client)\n    │\n    ├── tests                                 // the test code\n    │\n    ├── setup.py                              // used to install or package\n    │\n    └── README.md                             // the introduction of nebula3-python\n\n```\n\n\n## Contribute to Nebula-Python\n\n\u003cdetails\u003e\n\u003csummary\u003eClick to expand\u003c/summary\u003e\n\nTo contribute, start by [forking](https://github.com/vesoft-inc/nebula-python/fork) the repository. Next, clone your forked repository to your local machine. Remember to substitute `{username}` with your actual GitHub username in the URL below:\n\n```bash\ngit clone https://github.com/{username}/nebula-python.git\ncd nebula-python\n```\nFor package management, we utilize [PDM](https://github.com/pdm-project/pdm). Please begin by installing it:\n\n```bash\npipx install pdm\n```\n\nVisit the [PDM documentation](https://pdm-project.org) for alternative installation methods.\n\nInstall the package and all dev dependencies:\n\n```bash\npdm install\n```\n\nMake sure the Nebula server in running, then run the tests with pytest:\n\n```bash\npdm test\n```\n\nUsing the default formatter with [black](https://github.com/psf/black).\n\nPlease run `pdm fmt` to format python code before submitting.\n\nSee [How to contribute](https://github.com/vesoft-inc/nebula-community/blob/master/Contributors/how-to-contribute.md) for the general process of contributing to Nebula projects.\n\n\u003c/details\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvesoft-inc%2Fnebula-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvesoft-inc%2Fnebula-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvesoft-inc%2Fnebula-python/lists"}