mysqlx.CreateCollectionIndexStatement

class mysqlx.CreateCollectionIndexStatement(collection: DatabaseObject, index_name: str, index_desc: Dict[str, Any])

Bases: Statement

A statement that creates an index on a collection.

Parameters:
  • collection (mysqlx.Collection) – Collection.

  • index_name (string) – Index name.

  • index_desc (dict) –

    A dictionary containing the fields members that constraints the index to be created. It must have the form as shown in the following:

    {"fields": [{"field": member_path,
                 "type": member_type,
                 "required": member_required,
                 "collation": collation,
                 "options": options,
                 "srid": srid},
                 # {... more members,
                 #      repeated as many times
                 #      as needed}
                 ],
     "type": type}
    

property changed: bool

True if this statement has changes.

Type:

bool

property deallocate_prepare_execute: bool

True to deallocate + prepare + execute statement.

Type:

bool

property exec_counter: int

The number of times this statement was executed.

Type:

int

execute() Result

Execute the statement.

Returns:

Result object.

Return type:

mysqlx.Result

increment_exec_counter() None

Increments the number of times this statement has been executed.

is_doc_based() bool

Check if it is document based.

Returns:

True if it is document based.

Return type:

bool

property prepared: bool

True if this statement has been prepared.

Type:

bool

property repeated: bool

True if this statement was executed more than once.

Type:

bool

reset_exec_counter() None

Resets the number of times this statement has been executed.

property schema: Schema

The Schema object.

Type:

mysqlx.Schema

property stmt_id: int

Returns this statement ID.

Returns:

The statement ID.

Return type:

int

property target: DatabaseObject

The database object target.

Type:

object