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
exec_select_sql(self, select_sql) -> DSResult:
- select_sql: SQL语句,字符串类型。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file laiye-dataservice-sdk-1.6.3.2.tar.gz.
File metadata
- Download URL: laiye-dataservice-sdk-1.6.3.2.tar.gz
- Upload date:
- Size: 18.8 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14a5c207b1ebe07b8f284f9232d15179f3d6847faa93dbb1ce5af247a38eca83
|
|
| MD5 |
765712cccc517824c7f6982478c291f4
|
|
| BLAKE2b-256 |
115ebbfbb0746eec02885ccfa5c483575432c2a5c33efc83563e1e856c2618dc
|
File details
Details for the file laiye_dataservice_sdk-1.6.3.2-py3-none-any.whl.
File metadata
- Download URL: laiye_dataservice_sdk-1.6.3.2-py3-none-any.whl
- Upload date:
- Size: 25.5 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f393f23848b6ef439427d129cc0e16894478fe7c44143987cffd3a8553ef3c0
|
|
| MD5 |
1eca6d633e9ad4db0440c11012c2ea60
|
|
| BLAKE2b-256 |
bebf70cddc05ca913f3985d1f9e5cbbb1036e3c4b965a58ce570f34772e25c36
|