mysqlx.View

class mysqlx.View(schema, name)

Bases: Table

Represents a database view on a schema.

Provides a mechanism for creating, alter and drop views.

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

  • name (str) – The table name.

am_i_real()

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()

Counts the rows in the table.

Returns:

The total of rows in the table.

Return type:

int

delete()

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()

Verifies if this object exists in the database.

Returns:

True if object exists in database.

Return type:

bool

get_connection()

Returns the underlying connection.

Returns:

The connection object.

Return type:

mysqlx.connection.Connection

get_name()

Returns the name of this database object.

Returns:

The name of this database object.

Return type:

str

get_schema()

Returns the Schema object of this database object.

Returns:

The Schema object.

Return type:

mysqlx.Schema

get_session()

Returns the session of this database object.

Returns:

The Session object.

Return type:

mysqlx.Session

insert(*fields)

Creates a new mysqlx.InsertStatement object.

Parameters:

*fields – The fields to be inserted.

Returns:

InsertStatement object

Return type:

mysqlx.InsertStatement

is_view()

Determine if the underlying object is a view or not.

Returns:

True if the underlying object is a view.

Return type:

bool

property name

The name of this database object.

Type:

str

property schema

The Schema object.

Type:

mysqlx.Schema

select(*fields)

Creates a new mysqlx.SelectStatement object.

Parameters:

*fields – The fields to be retrieved.

Returns:

SelectStatement object

Return type:

mysqlx.SelectStatement

property session

The Session object.

Type:

mysqlx.Session

update()

Creates a new mysqlx.UpdateStatement object.

Returns:

UpdateStatement object

Return type:

mysqlx.UpdateStatement

who_am_i()

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.