mysqlx.View¶
- class mysqlx.View(schema: Schema, name: str | bytes)¶
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() 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:
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:
- get_session() Session ¶
Returns the session of this database object.
- Returns:
The Session object.
- Return type:
- insert(*fields: Any) InsertStatement ¶
Creates a new
mysqlx.InsertStatement
object.- Parameters:
*fields – The fields to be inserted.
- Returns:
InsertStatement object
- Return type:
- 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
- select(*fields: str) SelectStatement ¶
Creates a new
mysqlx.SelectStatement
object.- Parameters:
*fields – The fields to be retrieved.
- Returns:
SelectStatement object
- Return type:
- update() UpdateStatement ¶
Creates a new
mysqlx.UpdateStatement
object.- Returns:
UpdateStatement object
- Return type:
- 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.