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语句,字符串类型。

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.1.tar.gz (7.0 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.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: laiye-dataservice-sdk-1.6.3.1.tar.gz
  • Upload date:
  • Size: 7.0 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.1.tar.gz
Algorithm Hash digest
SHA256 645b28b464349399df31289aadc85292d5659c33b32ec217810128b849885171
MD5 e6ae390cf472a151b6ff72ce2c49cc4a
BLAKE2b-256 301e7474e1d1ba03bd0bf516c3bc6f71a17a8ec0e979ae27ef7a79bcda25c6ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: laiye_dataservice_sdk-1.6.3.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 705deafd57006a5488f1f11728490c4638bd1b7671533fdb4541f3d827c26f0e
MD5 4c37fbf5fa99902413fedd117e6b2177
BLAKE2b-256 14d3da7193ddae1d875c436b8aa343d10e35c5c60762c42bc5691572c99f1fe7

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