6.3.1 mysql.utilities.command.grep — Search Databases for Objects

This module provides utilities to search for objects on a server. The module defines a set of object types that can be searched by searching the fields of each object. The notion of an object field is very loosely defined and means any names occurring as part of the object definition. For example, the fields of a table include the table name, the column names, and the partition names (if it is a partitioned table).

Constants

The following constants denote the object types that can be searched.

The following constant is a sequence of all the object types that are available. It can be used to generate a version-independent list of object types that can be searched; for example, options and help texts.

Classes

class mysql.utilities.command.grep.ObjectGrep(pattern[, database_pattern=None, types=OBJECT_TYPES, check_body=False, use_regexp=False])

Search MySQL server instances for objects where the name (or content, for routines, triggers, or events) matches a given pattern.

sql() - string

Return the SQL code for executing the search in the form of a SELECT statement.

Returns:SQL code for executing the operation specified by the options.
Return type:string

execute(connections[, output=sys.output, connector=mysql.connector])

Execute the search on each of the connections in turn and print an aggregate of the result as a grid table.

Parameters:
  • connections Sequence of connection specifiers to send the query to

  • output File object to use for writing the result

  • connector Connector to use for connecting to the servers