Skip to main content

No project description provided

Project description

这是来也数据服务对应的SDK。

Initialize a client | 初始化客户端

from laiye_dataservice import DataService, AuthorizationType, DSResult

client = DataService(
    "https://cloud.laiye.com/dataservice",
    'BuiltInUser',
    username="this is username",
    password="this is password",
    api_key=None,
    timeout_seconds=30,
    language='en'
)

result: DSResult = client.get_schema("schema_name")

print(result.get_data())
print(result.get_code())
print(result.get_message())

Authorization | 权限相关

logout

退出登录

logout()

示例

result: DSResult = client.logout()

Metadata Management | 元信息维护

create_schema

添加数据表

create_schema(self, schema_api_name, display_name, description='') -> DSResult

  • schema_api_name: 数据表名称
  • display_name: 数据表显示名称
  • description: 描述信息,默认为空字符串

示例

result: DSResult = self.ds.create_schema("test_01", "Test 01", "")

delete_schema

删除数据表

delete_schema(self, schema_api_name, expansion_level=2) -> DSResult

  • schema_api_name: 数据表名称
  • expansion_level: 数据展开层级,默认为2

get_schemas

获取数据表列表

get_schemas(self, start_id=0, limit=1000, order='asc', expansion_level=2) -> DSResult

  • start_id: 开始记录ID,默认值0。
  • limit: 返回的最多记录数,默认值1000。
  • order: 排序方式,默认为 'asc', 也可以选择 'desc'
  • expansion_level: 数据展开层级,默认为2

get_schema

获取数据表详情

get_schema(self, schema_api_name, expansion_level=2) -> DSResult

  • schema_api_name: 数据表名称
  • expansion_level: 数据展开层级,默认为2

add_fields

添加字段-批量

add_fields(self, schema_api_name, fields, expansion_level=2) -> DSResult

  • schema_api_name: 数据表名称
  • fields: 字段数据,是一个字典数组
[
  {
    "apiName": "",
    "displayName": "",
    "description": "",
    "dataMaxLength": 0,
    "dataMaxValue": 0,
    "dataMinLength": 0,
    "dataMinValue": 0,
    "defaultValue": "",
    "fieldType": "", # 字段类型,可用值:BOOLEAN,DATE,DATETIME,DOUBLE,FILE,HTML,IMAGE,JSON,LONG,MARKDOWN,RELATIONSHIP,TEXT,TIME
    "orderNum": 0,
    "pointLength": 0,
    "referenceDisplayFieldApiName": "",
    "referenceJoinFieldApiName": "",
    "referenceSchemaApiName": "",
    "allowNull": false,
  }
]
  • expansion_level: 数据展开层级,默认为2

delete_fields

删除字段-批量

delete_fields(self, schema_api_name, field_api_names, expansion_level=2) -> DSResult:

  • schema_api_name: 数据表名称
  • field_api_names: 字段名称列表
  • expansion_level: 数据展开层级,默认为2

add_index

添加索引

add_index(self, schema_api_name, index, expansion_level=2) -> DSResult

  • schema_api_name: 数据表名称
  • index: 要增加的索引描述
{
  "apiName": "",
  "description": "",
  "displayName": "",
  "fieldApiNames": ['field1', 'field2'],
  "type": "UNIQUE" # 索引类型,可用值:GENERAL,UNIQUE
}
  • expansion_level: 数据展开层级,默认为2

get_index

获取单个索引信息

get_index(self, schema_api_name, index_api_name, expansion_level=2) -> DSResult

  • schema_api_name: 数据表名称
  • index_api_name: 索引名称
  • expansion_level: 数据展开层级,默认为2

Data Management | 数据管理

add_records

新增实体(记录)

add_record(self, schema_api_name, record, update_or_insert=False, response_with_data=False) -> DSResult

  • schema_api_name: 数据表名称
  • record: 数据记录,是一个字典
{"name": "Tom", "age":  20}
  • update_or_insert: 如果数据存在是否将其替换,默认为 False。这个能力需要在数据表上先创建唯一索引。

add_records

新增实体(记录)-批量

add_records(self, schema_api_name, records, update_or_insert=False, response_with_data=False) -> DSResult

  • schema_api_name: 数据表名称
  • records: 数据记录,是一个字典数组
[{"name": "Tom", "age":  20}, {"name": "Jack", "length":  180}]
  • update_or_insert: 如果数据存在是否将其替换,默认为 False。这个能力需要在数据表上先创建唯一索引。

delete_records

删除实体(记录)-批量

def delete_records(self, schema_api_name, record_ids, response_with_data=False) -> DSResult:

  • schema_api_name: 数据表名称
  • record_ids: 记录ID列表
  • response_with_data: 是否将操作的数据返回,默认为False。

delete_record

删除实体(记录)

delete_record(self, schema_api_name, record_id, response_with_data=False) -> DSResult:

  • schema_api_name: 数据表名称
  • record_id: 记录ID
  • response_with_data: 是否将操作的数据返回,默认为False。

search_records

查询实体(记录)列表-支持组合查询条件和组合排序条件

search_records(self, schema_api_name, search_data) -> DSResult:

  • schema_api_name: 数据表名称
  • search_data: 查询消息体

get_records

获取实体(记录)列表

get_records(self, schema_api_name, start_id=0, limit=1000, order='asc') -> DSResult

  • schema_api_name: 数据表名称
  • start_id: 开始记录ID,默认值0。
  • limit: 返回的最多记录数,默认值1000。
  • order: 排序方式,默认为 'asc', 也可以选择 'desc'

update_records

更新实体(记录)-批量

update_records(self, schema_api_name, records, response_with_data=False) -> DSResult:

  • schema_api_name: 数据表名称
  • records: 要修改的记录列表,一个字典列表。
  • response_with_data: 是否将操作的数据返回,默认为False。

update_record

更新实体(记录)

update_record(self, schema_api_name, record_id, record, response_with_data=False) -> DSResult:

  • schema_api_name: 数据表名称
  • record_id: 记录ID
  • record: 要修改的记录,一个字典。
  • response_with_data: 是否将操作的数据返回,默认为False。

exec_select_sql

SQL执行

exec_select_sql(self, select_sql) -> DSResult:

  • select_sql: SQL语句,字符串类型。

分析数据获取

get_queries

get_queries(self, page=1, page_size=20, order='created_at') -> DSResult:

get_query

get_query(self, query_id) -> DSResult:

exec_query

exec_query(self, query_id, params={}) -> DSResult:

get_job_status

get_job_status(self, job_id) -> DSResult:

get_cached_query_result

get_cached_query_result(self, query_id, result_id) -> DSResult:

get_query_result

get_query_result(self, query_id, params={}, if_refresh=False, time_seconds=30) -> DSResult:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laiye-dataservice-sdk-1.6.3.3.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laiye_dataservice_sdk-1.6.3.3-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file laiye-dataservice-sdk-1.6.3.3.tar.gz.

File metadata

  • Download URL: laiye-dataservice-sdk-1.6.3.3.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for laiye-dataservice-sdk-1.6.3.3.tar.gz
Algorithm Hash digest
SHA256 f35472a61bccf408bf6d46821829cf6ede22dcd025198b1a989b68443e52d7b5
MD5 a2ae90de52cd20e5d89b9f8ebea7ab31
BLAKE2b-256 333c0b93c6ca6dd2827f97f5bbb44b6cf2871a04232ed9b5eedd5cf5eabfff4f

See more details on using hashes here.

File details

Details for the file laiye_dataservice_sdk-1.6.3.3-py3-none-any.whl.

File metadata

  • Download URL: laiye_dataservice_sdk-1.6.3.3-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for laiye_dataservice_sdk-1.6.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 98629fbc4648953581d27d928b5da2c52997f2cf6641796be0a79f295df080c1
MD5 d6a92a614aa511d992440667a881b952
BLAKE2b-256 6f0822ed342a7a8d331defd8b59ed399c59d889c92ca32325602efa7917ec433

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page