mysqlx.AddStatement

class mysqlx.AddStatement(collection: DatabaseObject)

Bases: WriteStatement

A statement for document addition on a collection.

Parameters:

collection (mysqlx.Collection) – The Collection object.

add(*values: DbDoc) AddStatement

Adds a list of documents into a collection.

Parameters:

*values – The documents to be added into the collection.

Returns:

AddStatement object.

Return type:

mysqlx.AddStatement

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

get_values() List[int | str | DbDoc | Dict[str, Any] | List[str | int | float | ExprParser | Dict[str, Any] | None]]

Returns the list of values.

Returns:

The list of values.

Return type:

list

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

is_upsert() bool

Returns True if it’s an upsert.

Returns:

True if it’s an upsert.

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

upsert(value: bool = True) AddStatement

Sets the upset flag to the boolean of the value provided. Setting of this flag allows updating of the matched rows/documents with the provided value.

Parameters:

value (optional[bool]) – Set or unset the upsert flag.