mysqlx.Table¶
- class mysqlx.Table(schema: Schema, name: str | bytes)¶
Bases:
DatabaseObjectRepresents 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.DeleteStatementobject.- Returns:
DeleteStatement object
- Return type:
Changed in version 8.0.12: The
conditionparameter 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() ConnectionType¶
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() SessionType¶
Returns the session of this database object.
- Returns:
The Session object.
- Return type:
- insert(*fields: Any) InsertStatement¶
Creates a new
mysqlx.InsertStatementobject.- 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.SelectStatementobject.- Parameters:
*fields – The fields to be retrieved.
- Returns:
SelectStatement object
- Return type:
- property session: SessionType¶
The Session object.
- Type:
- update() UpdateStatement¶
Creates a new
mysqlx.UpdateStatementobject.- 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.