修改密码

请输入密码
请输入密码 请输入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

      连接数据库

      安装嬴图Python驱动并部署一个嬴图实例后,就可以将应用于数据库连接了。

      你可以使用UltipaConfig类的配置建立一个连接,点击查看UltipaConfig参数

      建立连接

      使用Connection类的NewConnection方法创建连接:

      from ultipa import Connection, UltipaConfig
      
      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)
      
      # Tests the connection: The connection is successfully established if the code is 0
      response = Conn.test()
      print("Code =", response.status.code)
      

      Code = 0
      

      使用配置文件

      本例演示如何使用配置文件.env建立连接:

      import os
      from pathlib import Path
      from dotenv import dotenv_values, load_dotenv
      from ultipa import Connection, UltipaConfig
      
      # Loads the .env file and overrides system environment variables
      env_path = Path('./.env')
      env_dict = dotenv_values(dotenv_path=env_path)
      load_dotenv(encoding='utf-8', override=True)
      
      hosts = os.getenv("hosts").split(",")
      username = os.getenv("username")
      password = os.getenv("password")
      
      ultipaConfig = UltipaConfig(hosts=hosts, username=username, password=password, heartBeat=10)
      Conn = Connection.NewConnection(defaultConfig=ultipaConfig)
      
      response = Conn.test()
      # The connection is successfully established if the code is 0
      print("Code =", response.status.code)
      

      Code = 0
      

      .env文件示例:

      #hosts=https://mqj4zouys.us-east-1.cloud.ultipa.com:60010
      hosts=192.168.1.85:60061,192.168.1.86:60061,192.168.1.87:60061
      username=<username>
      password=<password>
      passwordEncrypt=PasswordEncrypt.MD5
      defaultGraph=miniCircle
      #crt=F:\\ultipa.crt
      #maxRecvSize=10240
      

      UltipaConfig参数

      UltipaConfig类有以下参数:

      参数
      类型
      默认
      描述
      hosts List[str] / 必填,逗号分隔的数据库服务器IP或URL地址。如果URL没有以https://http://开头,默认使用http://
      username str / 必填,服务器验证的用户名
      password str / 必填,服务器验证的密码
      defaultGraph str / 默认使用的图名称
      crt str / 建立安全连接所需的SSL证书文件路径
      passwordEncrypt PasswordEncrypt PasswordEncrypt.MD5 驱动的密码加密方式,支持MD5LDAPNOTHING
      timeout int 15 连接超时阈值(单位:秒)
      heartBeat int 0 用于保持连接为活跃状态的心跳间隔(单位:毫秒),设置为0关闭心跳
      maxRecvSize int 32 接收数据的最大大小(单位:MB)
      debug bool False 是否使用调试模式
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写