修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

v5.0
搜索
    v5.0

      数据导出

      本节介绍用于导出点、边的方法。

      export()

      导出图中的点或边。

      参数

      • exportRequest: ExportRequest:导出请求的配置,包括dbTypeschemaselectPropertiesgraph
      • cb: Callable[[List[Node], List[Edge]], None]:导出数据时执行的回调函数。
      • config: RequestConfig(可选):请求配置。

      返回值

      # Exports 'account' nodes in the graph 'miniCircle'
      
      batch_counter = 0 # Global counter for batch tracking
      
      exportRequest = ExportRequest(
          dbType=DBType.DBNODE,
          schema="account",
          selectProperties=["_id", "name", "year"],
          graph="miniCircle"
      )
      
      def handle_export(nodes: List[Node], edges: List[Edge]): # Defines the callback function
          global batch_counter
          batch_counter += 1
      
          try:
              schema = exportRequest.schema
              if nodes:
                  df_nodes = pd.DataFrame([node.__dict__ for node in nodes]) # Converts to dictionary
                  df_nodes.to_csv(f"{schema}_nodes.csv", mode="a", index=False)
                  print(f"Batch {batch_counter} exported")
              if edges:
                  df_edges = pd.DataFrame([edge.__dict__ for edge in edges]) # Converts to dictionary
                  df_edges.to_csv(f"{schema}_edges.csv", mode="a", index=False)
                  print(f"Batch {batch_counter} exported")
          except Exception as e:
              print(f"Batch {batch_counter} export failed: {e}")
      
      Conn.export(exportRequest, handle_export)
      

      Batch 1 exported
      Batch 2 exported
      Batch 3 exported
      

      导出文件account_nodes.csv将保存到与执行文件相同的目录中。

      完整示例

      from typing import List
      import pandas as pd
      from ultipa import UltipaConfig, Connection, ExportRequest, DBType, Node, Edge
      
      ultipaConfig = UltipaConfig()
      # URI example: ultipaConfig.hosts = ["https://mqj4zouys.us-east-1.cloud.ultipa.com:60010"]
      ultipaConfig.hosts = ["192.168.1.85:60061", "192.168.1.87:60061", "192.168.1.88:60061"]
      ultipaConfig.username = "<username>"
      ultipaConfig.password = "<password>"
      
      Conn = Connection.NewConnection(defaultConfig=ultipaConfig)
      
      # Exports 'account' nodes in the graph 'miniCircle'
      
      batch_counter = 0 # Global counter for batch tracking
      
      exportRequest = ExportRequest(
          dbType=DBType.DBNODE,
          schema="account",
          selectProperties=["_id", "name", "year"],
          graph="miniCircle"
      )
      
      def handle_export(nodes: List[Node], edges: List[Edge]): # Defines the callback function
          global batch_counter
          batch_counter += 1
      
          try:
              schema = exportRequest.schema
              if nodes:
                  df_nodes = pd.DataFrame([node.__dict__ for node in nodes]) # Converts to dictionary
                  df_nodes.to_csv(f"{schema}_nodes.csv", mode="a", index=False)
                  print(f"Batch {batch_counter} exported")
              if edges:
                  df_edges = pd.DataFrame([edge.__dict__ for edge in edges]) # Converts to dictionary
                  df_edges.to_csv(f"{schema}_edges.csv", mode="a", index=False)
                  print(f"Batch {batch_counter} exported")
          except Exception as e:
              print(f"Batch {batch_counter} export failed: {e}")
      
      Conn.export(exportRequest, handle_export)
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写