mysqlx.Table

class mysqlx.Table(schema: Schema, name: str | bytes)

Bases: DatabaseObject

Represents a database table on a schema.

Provides access to the table through standard INSERT/SELECT/UPDATE/DELETE statements.

Parameters:
  • schema (mysqlx.Schema) – The Schema object.

  • name (str) – The table name.

am_i_real() Any

Verifies if this object exists in the database.

Returns:

True if object exists in database.

Return type:

bool

Raises:

NotImplementedError – This method must be implemented.

Deprecated since version 8.0.12: Use exists_in_database() method instead.

count() int

Counts the rows in the table.

Returns:

The total of rows in the table.

Return type:

int

delete() DeleteStatement

Creates a new mysqlx.DeleteStatement object.

Returns:

DeleteStatement object

Return type:

mysqlx.DeleteStatement

Changed in version 8.0.12: The condition parameter was removed.

exists_in_database() bool

Verifies if this object exists in the database.

Returns:

True if object exists in database.

Return type:

bool

get_connection() Connection

Returns the underlying connection.

Returns:

The connection object.

Return type:

mysqlx.connection.Connection

get_name() str

Returns the name of this database object.

Returns:

The name of this database object.

Return type:

str

get_schema() Schema

Returns the Schema object of this database object.

Returns:

The Schema object.

Return type:

mysqlx.Schema

get_session() Session

Returns the session of this database object.

Returns:

The Session object.

Return type:

mysqlx.Session

insert(*fields: Any) InsertStatement

Creates a new mysqlx.InsertStatement object.

Parameters:

*fields – The fields to be inserted.

Returns:

InsertStatement object

Return type:

mysqlx.InsertStatement

is_view() bool

Determine if the underlying object is a view or not.

Returns:

True if the underlying object is a view.

Return type:

bool

property name: str

The name of this database object.

Type:

str

property schema: Schema

The Schema object.

Type:

mysqlx.Schema

select(*fields: str) SelectStatement

Creates a new mysqlx.SelectStatement object.

Parameters:

*fields – The fields to be retrieved.

Returns:

SelectStatement object

Return type:

mysqlx.SelectStatement

property session: Session

The Session object.

Type:

mysqlx.Session

update() UpdateStatement

Creates a new mysqlx.UpdateStatement object.

Returns:

UpdateStatement object

Return type:

mysqlx.UpdateStatement

who_am_i() str

Returns the name of this database object.

Returns:

The name of this database object.

Return type:

str

Deprecated since version 8.0.12: Use get_name() method instead.