graviti.openapi.schema#

Interfaces about the schema.

Module Contents#

Functions#

update_schema(access_key, url, workspace, dataset, *, draft_number, sheet, patch = None, _schema, _avro_schema, _arrow_schema = None)

Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/schema.

graviti.openapi.schema.update_schema(access_key, url, workspace, dataset, *, draft_number, sheet, patch=None, _schema, _avro_schema, _arrow_schema=None)[source]#

Execute the OpenAPI PATCH /v2/datasets/{workspace}/{dataset}/drafts/{draft_number} /sheets/{sheet}/schema.

Parameters
  • access_key (str) – User’s access key.

  • url (str) – The URL of the graviti website.

  • workspace (str) – The workspace of the dataset.

  • dataset (str) – Name of the dataset, unique for a user.

  • draft_number (int) – The draft number.

  • sheet (str) – The sheet name.

  • patch (Optional[List[Dict[str, Any]]]) – The list of patch operations which describe the changes to the json portex schema.

  • _schema (str) –

  • _avro_schema (str) –

  • _arrow_schema (Optional[str]) –

Return type

None

Examples

>>> update_schema(
...     "ACCESSKEY-********",
...     "https://api.graviti.com",
...     "graviti-example",
...     "MNIST",
...     draft_number = 1,
...     sheet = "train",
...     _schema = '{"imports": [{"repo": "https://github.com/Project-OpenBytes/portex-standard@main", "types": [{"name": "file.Image"}]}], "type": "record", "fields": [{"name": "filename", "type": "string"}, {"name": "image", "type": "file.Image"}]}',
...     _avro_schema = '{"type": "record", "name": "root", "namespace": "cn.graviti.portex", "aliases": [], "fields": [{"name": "filename", "type": "string"}, {"name": "image", "type": {"type": "record", "name": "image", "namespace": "cn.graviti.portex.root", "aliases": [], "fields": [{"name": "checksum", "type": [null, "string"]}]}}]}',
... )