execute Method

On This Page

Description

Executes the specified command. This method is used to extend the basic functionality of the other client methods. Currently, the NoSQL backend supports an inferschema command with an infer alias for inferring the table schema.

Syntax

execute(backend, table, command=""[, args=None])

Parameters and Data Members

args | backend | command | table

backend
The backend type — "kv" for the NoSQL backend. See Backend Types.

  • Type: str
  • Requirement: Required
table
The relative path to the backend data — a directory in the target data container (as configured for the client object) that represents a NoSQL table. For example, "mytable" or "examples/nosql/my_table".

  • Type: str
  • Requirement: Required
command
The command to execute.

  • Type: str
  • Requirement: Required
  • Valid Values: The NoSQL backend currently supports an "inferschema" or "infer" command, which infers the schema of a given NoSQL table and creates a schema for the table. The command creates a .#schema file in the table directory. For more information, see Table Schema in the Frames NoSQL backend overview. All references to the inferschema command in the documentation apply also to the infer alias.
args

A dictionary of "<argument name>": <value> pairs for passing additional backend-specific method parameters (arguments).

  • Type: dict
  • Requirement: Optional
  • Default Value: None
inferschema Command Arguments

The inferschema command of the NoSQL backend supports the following arguments:

key
The name of the table’s primary-key attribute.

Note
This argument is intended for internal use, as the infer-schema command should typically identify and set the key automatically.
  • Type: str
  • Requirement: Optional [FOR INTERNAL USE]

Examples

inferschema Examples

Following are examples of using the inferschema command of the execute method or its infer alias:

  1. Infer the schema of a mytable table in the client’s data container (table) using the infer command (command):

    client.execute(backend="kv", table="mytable", command="infer")
  2. Infer the schema of a my_tables/students table in the client’s data container (table) using inferschema (command):

    client.execute("kv", table="/my_tables/students", command="inferschema")

See Also