SlideShare a Scribd company logo
1 of 34
Download to read offline
<Insert Picture Here>




Python Utilities for Managing
MySQL Databases
Mats Kindahl, Lars Thalmann, Chuck Bell
THE FOLLOWING IS INTENDED TO OUTLINE OUR GENERAL
    PRODUCT DIRECTION. IT IS INTENDED FOR INFORMATION
    PURPOSES ONLY, AND MAY NOT BE INCORPORATED INTO
    ANY CONTRACT. IT IS NOT A COMMITMENT TO DELIVER ANY
    MATERIAL, CODE, OR FUNCTIONALITY, AND SHOULD NOT BE
    RELIED UPON IN MAKING PURCHASING DECISION. THE
    DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR
    FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS
    REMAINS AT THE SOLE DISCRETION OF ORACLE.




2
About the Speakers
    • Mats Kindahl, PhD
      • Replication Expert and Lead Developer
      • mats.kindahl@oracle.com
    • Lars Thalmann, PhD
      • Development Director, Replication, and Backup
      • lars.thalmann@oracle.com
    • Chuck Bell, PhD (not present)
      • MySQL Utilities and Replication
      • chuck.bell@oracle.com




3
Topics
    •   Introduction to MySQL Utilities
    •   List of current utilities
    •   Architecture of MySQL Utilities
    •   Examples of usage
    •   Using the MySQL Utilities Python Library




4
What is MySQL Utilities?
    • A collection of Python utilities for managing MySQL
      databases
    • Part of MySQL Workbench 5.2.31
    • Available under the GPLv2 license
    • Written in Python
    • Easily enhanced using a growing code library
    • Goal is to provide a Python library to grow solutions
      for common administrative problems




5
List of Utilities
    •   mysqldbcompare – compare databases
    •   mysqldbcopy – copy databases between servers
    •   mysqldbexport – export metadata and data
    •   mysqldbimport – import metadata and data
    •   mysqldiff – compare object definitions
    •   mysqldiskusage – show disk usage for databases
    •   mysqlindexcheck – check for redundant indexes
    •   mysqlmetagrep – search metadata
    •   mysqlprocgrep – search process information
    •   mysqlreplicate – setup replication
    •   mysqlrplcheck – check replication configuration


6
List of Utilities
    •   mysqlserverclone – start a scratch server
    •   mysqlserverinfo – show server information
    •   mysqluc – console for utilities
    •   mysqluserclone – clone a user account




7
Utilities in MySQL Workbench
    • Launch the MySQL Utilities command window:
          – Click on the Plugins menu item
          – Select “Start Shell for MySQL Utilities”


    OR

    • From the Workbench main window:
          – Click on the drop down arrow icon to the right of the
               main window
          – Scroll through screens to find the MySQL Utilities icon




8
How do I access the utilities?




9
How do I access the utilities?




10
Structure of the MySQL Utilities

                                            mysqlprocgrep
                               Scripts




          Command                        Common
           Module                         Module
     mysql.utilities.command       mysql.utilities.common

                                  MySQL Utilities Library

11
mysqldbcompare – compare databases
     • Find missing objects from either database
     • Find objects that differ in definition
     • Find differences in data among tables
     • Print difference in formats differ, ndiff, or context
     • Print output rows in GRID, TAB, CSV, or VERTICAL
       formats
     • Scenarios
          • checking master and slave for consistency
          • checking production and development databases for
            consistency
          • generating a difference report for expected differences
            among new and old data
          • comparing backups for differences

12
Sample execution
     $   mysqldbcompare --server1=root@localhost --server2=root@backup_host:3310 
     >   inventory:inventory --run-all-tests
     #   server1 on localhost: ... connected.
     #   server2 on localhost: ... connected.
     #   Checking databases inventory on server1 and inventory on server2

     WARNING: Objects in server1:inventory but not in server2:inventory:
             VIEW: finishing_up
             VIEW: cleaning
                                                         Defn    Row     Data
     Type      Object Name                               Diff    Count   Check
     ---------------------------------------------------------------------------
     TABLE     supplier                                  pass    FAIL    FAIL

     Row counts are not the same among inventory.supplier and inventory.supplier.

     Data differences found among rows:
     --- inventory.supplier
     +++ inventory.supplier
     @@ -1,2 +1,2 @@
      code,name
     -2,Never Enough Inc.       <user>:<password>@<host>:<port>:<socket>
     +2,Wesayso Corporation




13
mysqlmetagrep – search objects
     • Search for objects with names matching a pattern
     • Match using SQL patterns or POSIX regular
       expressions
     • Search bodies of routines (procedures, events,
       triggers)
     • Generate SQL for executing the query
           – Can be used in applications
           – Can be stored in events or views




                                                  _”



14
Searching for objects by name
     Searching a database for objects starting with “t”

       mysqlmetagrep ­­pattern="t_" ­­server=mats@localhost


     $ mysqlmetagrep ­­pattern="t_" ­­server=mats@localhost
     +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+
     | Connection             | Object Type  | Object Name  | Database  | Field Type  | Matches  |
     +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+
     | mats:*@localhost:3307  | TABLE        | t1           | test      | COLUMN      | th       |
     | mats:*@localhost:3307  | TABLE        | t1           | test      | TABLE       | t1       |
     | mats:*@localhost:3307  | TABLE        | t2           | test      | TABLE       | t2       |
     | mats:*@localhost:3307  | TABLE        | tt5          | test      | COLUMN      | t2,t1    |
     +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+




15
Searching routine bodies
      Searching a database for objects containing “l_host”

      mysqlmetagrep ­­body ­­pattern="%l_host%"  
         ­­server=mats@localhost


$ mysqlmetagrep ­­body ­­pattern="%l_host%" ­­server root@localhost:3307
+­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
| Connection             | Object Type  | Object Name    | Database  | Field Type  | Matches        |
+­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+
| root:*@localhost:3307  | PROCEDURE    | switch_master  | test      | ROUTINE     | switch_master  |
+­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+




16
mysqlprocgrep – search processes
     • Search processes on multiple machines
     • Match by PROCESSLIST fields
           – Id, State, User, Host, Database, Command, State, Info
     • Match by age
           – Find long-running queries, or idle connections
     • Get SQL for performing the query or action
           – Put in application
           – Put in events
     • Kill queries or connections
           – Option: ­­kill­query
           – Option: ­­kill­connection




17
Sample usage
       • Find queries by 'www-data' that have been executing
         for more than 20 minutes
           mysqlprocgrep ­­server=mats@example.com
             ­­match­user=www­data
             ­­match­state=executing
             ­­age=20m 

 +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+
 | Connection               | Id  | User  | Host         | Db    | Command  | Time  | State      | Info               |
 +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+
 | mats:*@example.com:3306  | 53  | mats  | example.com  | user  | Query    | 2040  | executing  | select …           |
 +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+




18
Sample usage
     • Find queries by 'www-data' that have been executing
       for more than 20 minutes
         mysqlprocgrep ­­server=mats@example.com

                                                        m!
           ­­match­user=www­data
           ­­match­state=executing
                                                    The
           ­­age=20m ­­kill­query            i ll
                                               K




19
mysqlreplicate – setup replication
     • Permits an administrator to start replication among
       two servers.
     • User have to provide:
            – Login information to the slave
            – Connection information for the master
     • Example: Setup replication between two instances
     mysqlreplicate --rpl-user=rpl_user:xyzzy
        --master=root@localhost:3306 --slave=root@localhost:3307




20
mysqluc – MySQL Utilities Console
     • User defined variables
     • Help features
     • Tab completion (names, parameters, options,
       variables)




21
MySQL Utilities Python Library
     • Major classes for:
        •   Database
        •   Replication
        •   Server
        •   Index
        •   Table
        •   User
     • Also many helpful methods such as
        •   connect_servers()
        •   setup_common_options()
        •   format_tabular_list()
        •   find_running_servers()



22
Library Example
     • Goal: create a utility that makes a copy of a running
       server and copies all of the data and users.
     • Steps
        •   Setup the parameters
        •   Connect to the original server
        •   Find all of the databases
        •   Find all of the users
        •   Make a clone of the original server
        •   Copy all of the databases
        •   Copy all of the users




23
Utility options
     •   Server to read from: ­­server
     •   Databases: ­­databases
     •   Data directory for new server: ­­new­data
     •   Port for new server: ­­new­port
     •   Server ID for new server: ­­new­id




24
Set up options
     from optparse import OptionParser
     parser = OptionParser()
     parser.add_option("­­server",
                       action="store”, dest="server",
                       type="string", default="root@localhost:3306",
                       help="connection information for original server in "
                        "the form: <user>:<password>@<host>:<port>:<socket>")
     parser.add_option("­d", "­­databases",
                       action="store", dest="dbs_to_copy”, type="string",
                       help="comma­separated list of databases "
                         "to include in the copy (omit for all "
                         " databases)”, default=None)
                .
                .
                .




25
Library Example
     • Parse the connection information
      from mysql.utilities.common.options import parse_connection
      try:
        conn = parse_connection(opt.server)
      except:
        parser.error("Server connection values invalid or"
                     " cannot be parsed.")
     • Connect to original server
      from mysql.utilities.common.server import Server

      server_options = {'conn_info’ : conn, 'role’ : "source"}
      srv1 = Server(server_options)
      srv1.connect()




26
Library Example
     • Find all of the databases
     db_list = [ (db[0],None) for db in srv1.get_all_databases() ]



     • Find all of the users
     _QUERY = """
        SELECT user, host FROM mysql.user
         WHERE user != 'root’ AND user != ''
     """
     users = srv1.exec_query(_QUERY)
     user_list = [ user[0] + '@' + user[1] for user in users ]




27
Library Example
     • Make a clone of the original server

      from mysql.utilities.command.serverclone import clone_server

      res = clone_server(conn, opt.new_data, opt.new_port,
                         opt.new_id, "root", None, False, True)




28
Library Example
     • Copy all of the databases
      # Set destination server connection parameters
      from mysql.utilities.command import dbcopy
      dest = {
        "user"        : conn.get("user"),
        "passwd"      : "root",
        "host"        : conn.get("host"),
        "port"        : opt.new_port,
        "unix_socket" : os.path.join(opt.new_data, "mysql.sock"),
        }
      # Set options for copy
      options = {
        "quiet" : True,
        "force" : True,
        }

      dbcopy.copy_db(conn, dest, db_list, options)




29
Library Example
     • Copy all of the users
      from mysql.utilities.command.userclone import clone_user

      options = {
        "overwrite" : True,
        "quiet"     : True,
        "globals"   : True
      }

      for user in user_list:
        res = clone_user(conn, dest_values, user,
                         (user,), options)




30
Enhancing the example
     • Consistent copy?
            – Locking tables
            – Consistent snapshot (InnoDB)
     • Copying all users?
            – Users not related to the database?
            – Users with only global privileges?
     • Automatically start replication
     • Killing connections?




31
Where To Go From Here
     You can download MySQL Workbench from:
       http://www.mysql.com/downloads/workbench/

     You can also download the latest development source code
     tree for the MySQL Workbench Utilities from:
       http://launchpad/net/mysql­utilities




32
MySQL High Availability
       Get it as free ebook: http://oreilly.com/go/ebookrequest
       Valid this week, mention event “MySQL Replication
      Update”
     MySQL Support: www.mysql.com/contact

     PHP under the hood                      Thu 10:40am
     MySQL Technology Update                 Thu 2:30pm
     MySQL Binlog API                        Fri 10:00am

     Visit MySQL at Oracle booth 701!
33
34

More Related Content

What's hot

MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera ClusterAbdul Manaf
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesTarique Saleem
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Ted Wennmark
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability Mydbops
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Severalnines
 
PayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterPayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterMat Keep
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMario Beck
 
Sharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricSharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricMats Kindahl
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Mydbops
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningSeveralnines
 
Building Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricBuilding Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricMats Kindahl
 
Hello OpenStack, Meet Hadoop
Hello OpenStack, Meet HadoopHello OpenStack, Meet Hadoop
Hello OpenStack, Meet HadoopDataWorks Summit
 
MySQL Fabric: Easy Management of MySQL Servers
MySQL Fabric: Easy Management of MySQL ServersMySQL Fabric: Easy Management of MySQL Servers
MySQL Fabric: Easy Management of MySQL ServersMats Kindahl
 
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09OSSCube
 
Multi-tenant, Multi-cluster and Multi-container Apache HBase Deployments
Multi-tenant, Multi-cluster and Multi-container Apache HBase DeploymentsMulti-tenant, Multi-cluster and Multi-container Apache HBase Deployments
Multi-tenant, Multi-cluster and Multi-container Apache HBase DeploymentsDataWorks Summit
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 Geir Høydalsvik
 
My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015Sanjay Manwani
 
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document StoreConnector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document StoreFilipe Silva
 
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityRamp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityPythian
 

What's hot (20)

MariaDB Galera Cluster
MariaDB Galera ClusterMariaDB Galera Cluster
MariaDB Galera Cluster
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
PayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterPayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL Cluster
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Sharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL FabricSharding and Scale-out using MySQL Fabric
Sharding and Scale-out using MySQL Fabric
 
Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.Modern MySQL Monitoring and Dashboards.
Modern MySQL Monitoring and Dashboards.
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
Building Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL FabricBuilding Scalable High Availability Systems using MySQL Fabric
Building Scalable High Availability Systems using MySQL Fabric
 
Hello OpenStack, Meet Hadoop
Hello OpenStack, Meet HadoopHello OpenStack, Meet Hadoop
Hello OpenStack, Meet Hadoop
 
MySQL Fabric: Easy Management of MySQL Servers
MySQL Fabric: Easy Management of MySQL ServersMySQL Fabric: Easy Management of MySQL Servers
MySQL Fabric: Easy Management of MySQL Servers
 
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
 
Multi-tenant, Multi-cluster and Multi-container Apache HBase Deployments
Multi-tenant, Multi-cluster and Multi-container Apache HBase DeploymentsMulti-tenant, Multi-cluster and Multi-container Apache HBase Deployments
Multi-tenant, Multi-cluster and Multi-container Apache HBase Deployments
 
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015 2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
2015: Whats New in MySQL 5.7, At Oracle Open World, November 3rd, 2015
 
My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015My sql5.7 whatsnew_presentedatgids2015
My sql5.7 whatsnew_presentedatgids2015
 
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document StoreConnector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
Connector/J Beyond JDBC: the X DevAPI for Java and MySQL as a Document Store
 
Hadoop and OpenStack
Hadoop and OpenStackHadoop and OpenStack
Hadoop and OpenStack
 
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityRamp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
 

Viewers also liked

Www Kitebird Com Articles Pydbapi Html Toc 1
Www Kitebird Com Articles Pydbapi Html Toc 1Www Kitebird Com Articles Pydbapi Html Toc 1
Www Kitebird Com Articles Pydbapi Html Toc 1AkramWaseem
 
Rethink db with Python
Rethink db with PythonRethink db with Python
Rethink db with PythonPrabhu Raghav
 
Succumbing to the Python in Financial Markets
Succumbing to the Python in Financial MarketsSuccumbing to the Python in Financial Markets
Succumbing to the Python in Financial Marketsdcerezo
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014Henning Jacobs
 
MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLTed Leung
 
Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).Roberto Polli
 
Python for Derivative Analytics
Python for Derivative AnalyticsPython for Derivative Analytics
Python for Derivative AnalyticsAlicia G
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM Mark Rees
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQLPeter Eisentraut
 
PostgreSQLとPythonとSQL
PostgreSQLとPythonとSQLPostgreSQLとPythonとSQL
PostgreSQLとPythonとSQLSatoshi Yamada
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data AnalyticsEdureka!
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data AnalyticsEdureka!
 
St.John Freight Systems Ltd_Corporate Profile
St.John Freight Systems Ltd_Corporate ProfileSt.John Freight Systems Ltd_Corporate Profile
St.John Freight Systems Ltd_Corporate Profilevigneshd
 
Neural Text Embeddings for Information Retrieval (WSDM 2017)
Neural Text Embeddings for Information Retrieval (WSDM 2017)Neural Text Embeddings for Information Retrieval (WSDM 2017)
Neural Text Embeddings for Information Retrieval (WSDM 2017)Bhaskar Mitra
 
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLanandology
 
Aplicando Design Thinking al diseño de tu vida
Aplicando Design Thinking al diseño de tu vida Aplicando Design Thinking al diseño de tu vida
Aplicando Design Thinking al diseño de tu vida UX Nights
 
L'analytics pour les publishers conférence aadf
L'analytics pour les publishers   conférence aadfL'analytics pour les publishers   conférence aadf
L'analytics pour les publishers conférence aadfPrénom Nom de famille
 
Fluorochemical Solutions for the Automotive Industry
Fluorochemical Solutions for the Automotive IndustryFluorochemical Solutions for the Automotive Industry
Fluorochemical Solutions for the Automotive IndustryAGC Chemicals Americas
 
The Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to CompromiseThe Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to CompromiseWill Schroeder
 
La Normandie : son histoire
La Normandie : son histoireLa Normandie : son histoire
La Normandie : son histoirelaurentridel
 

Viewers also liked (20)

Www Kitebird Com Articles Pydbapi Html Toc 1
Www Kitebird Com Articles Pydbapi Html Toc 1Www Kitebird Com Articles Pydbapi Html Toc 1
Www Kitebird Com Articles Pydbapi Html Toc 1
 
Rethink db with Python
Rethink db with PythonRethink db with Python
Rethink db with Python
 
Succumbing to the Python in Financial Markets
Succumbing to the Python in Financial MarketsSuccumbing to the Python in Financial Markets
Succumbing to the Python in Financial Markets
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
MySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQLMySQL User Conference 2009: Python and MySQL
MySQL User Conference 2009: Python and MySQL
 
Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).Scaling mysql with python (and Docker).
Scaling mysql with python (and Docker).
 
Python for Derivative Analytics
Python for Derivative AnalyticsPython for Derivative Analytics
Python for Derivative Analytics
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
PostgreSQLとPythonとSQL
PostgreSQLとPythonとSQLPostgreSQLとPythonとSQL
PostgreSQLとPythonとSQL
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
St.John Freight Systems Ltd_Corporate Profile
St.John Freight Systems Ltd_Corporate ProfileSt.John Freight Systems Ltd_Corporate Profile
St.John Freight Systems Ltd_Corporate Profile
 
Neural Text Embeddings for Information Retrieval (WSDM 2017)
Neural Text Embeddings for Information Retrieval (WSDM 2017)Neural Text Embeddings for Information Retrieval (WSDM 2017)
Neural Text Embeddings for Information Retrieval (WSDM 2017)
 
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
 
Aplicando Design Thinking al diseño de tu vida
Aplicando Design Thinking al diseño de tu vida Aplicando Design Thinking al diseño de tu vida
Aplicando Design Thinking al diseño de tu vida
 
L'analytics pour les publishers conférence aadf
L'analytics pour les publishers   conférence aadfL'analytics pour les publishers   conférence aadf
L'analytics pour les publishers conférence aadf
 
Fluorochemical Solutions for the Automotive Industry
Fluorochemical Solutions for the Automotive IndustryFluorochemical Solutions for the Automotive Industry
Fluorochemical Solutions for the Automotive Industry
 
The Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to CompromiseThe Travelling Pentester: Diaries of the Shortest Path to Compromise
The Travelling Pentester: Diaries of the Shortest Path to Compromise
 
La Normandie : son histoire
La Normandie : son histoireLa Normandie : son histoire
La Normandie : son histoire
 

Similar to Python Utilities for Managing MySQL Databases

MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019Dave Stokes
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsTeamstudio
 
Monitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixMonitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixGerger
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best PracticesDavid Keener
 
4 docker small_web_micro_services
4 docker small_web_micro_services4 docker small_web_micro_services
4 docker small_web_micro_servicesFEG
 
MySQL Workbench for DFW Unix Users Group
MySQL Workbench for DFW Unix Users GroupMySQL Workbench for DFW Unix Users Group
MySQL Workbench for DFW Unix Users GroupDave Stokes
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Databasedharawagh9999
 
Php connectivitywithmysql
Php connectivitywithmysqlPhp connectivitywithmysql
Php connectivitywithmysqlBhumivaghasiya
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix
 
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015Dave Stokes
 
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...MediaMongrels Ltd
 
AZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxAZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxSonuShaw16
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nlbartzon
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveIBM Cloud Data Services
 
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppet
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015Dave Stokes
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nltieleman
 
Finding an unusual cause of max_user_connections in MySQL
Finding an unusual cause of max_user_connections in MySQLFinding an unusual cause of max_user_connections in MySQL
Finding an unusual cause of max_user_connections in MySQLOlivier Doucet
 

Similar to Python Utilities for Managing MySQL Databases (20)

MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
Monitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with ZabbixMonitoring Oracle Database Instances with Zabbix
Monitoring Oracle Database Instances with Zabbix
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best Practices
 
4 docker small_web_micro_services
4 docker small_web_micro_services4 docker small_web_micro_services
4 docker small_web_micro_services
 
MySQL Workbench for DFW Unix Users Group
MySQL Workbench for DFW Unix Users GroupMySQL Workbench for DFW Unix Users Group
MySQL Workbench for DFW Unix Users Group
 
PythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for DatabasePythonDatabaseAPI -Presentation for Database
PythonDatabaseAPI -Presentation for Database
 
Php connectivitywithmysql
Php connectivitywithmysqlPhp connectivitywithmysql
Php connectivitywithmysql
 
Clustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmarkClustrix Database Percona Ruby on Rails benchmark
Clustrix Database Percona Ruby on Rails benchmark
 
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
MySQL Workbench and Visual Explain -- RMUG Feb 19th 2015
 
Perl Programming - 04 Programming Database
Perl Programming - 04 Programming DatabasePerl Programming - 04 Programming Database
Perl Programming - 04 Programming Database
 
2. Lecture2_NOSQL_KeyValue.ppt
2. Lecture2_NOSQL_KeyValue.ppt2. Lecture2_NOSQL_KeyValue.ppt
2. Lecture2_NOSQL_KeyValue.ppt
 
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
Efficient working with Databases in LabVIEW - Sam Sharp (MediaMongrels Ltd) -...
 
AZMS PRESENTATION.pptx
AZMS PRESENTATION.pptxAZMS PRESENTATION.pptx
AZMS PRESENTATION.pptx
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
SQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The MoveSQL To NoSQL - Top 6 Questions Before Making The Move
SQL To NoSQL - Top 6 Questions Before Making The Move
 
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NYPuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
PuppetDB: A Single Source for Storing Your Puppet Data - PUG NY
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 
Finding an unusual cause of max_user_connections in MySQL
Finding an unusual cause of max_user_connections in MySQLFinding an unusual cause of max_user_connections in MySQL
Finding an unusual cause of max_user_connections in MySQL
 

More from Mats Kindahl

High-Availability using MySQL Fabric
High-Availability using MySQL FabricHigh-Availability using MySQL Fabric
High-Availability using MySQL FabricMats Kindahl
 
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFSMySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFSMats Kindahl
 
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal ScalingMySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal ScalingMats Kindahl
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUGMats Kindahl
 
Sharding using MySQL and PHP
Sharding using MySQL and PHPSharding using MySQL and PHP
Sharding using MySQL and PHPMats Kindahl
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & TricksMats Kindahl
 
MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011Mats Kindahl
 

More from Mats Kindahl (8)

Why rust?
Why rust?Why rust?
Why rust?
 
High-Availability using MySQL Fabric
High-Availability using MySQL FabricHigh-Availability using MySQL Fabric
High-Availability using MySQL Fabric
 
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFSMySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
MySQL Applier for Apache Hadoop: Real-Time Event Streaming to HDFS
 
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal ScalingMySQL Sharding: Tools and Best Practices for Horizontal Scaling
MySQL Sharding: Tools and Best Practices for Horizontal Scaling
 
Replication Tips & Trick for SMUG
Replication Tips & Trick for SMUGReplication Tips & Trick for SMUG
Replication Tips & Trick for SMUG
 
Sharding using MySQL and PHP
Sharding using MySQL and PHPSharding using MySQL and PHP
Sharding using MySQL and PHP
 
Replication Tips & Tricks
Replication Tips & TricksReplication Tips & Tricks
Replication Tips & Tricks
 
MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011
 

Recently uploaded

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 

Recently uploaded (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate AgentsRyan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
Ryan Mahoney - Will Artificial Intelligence Replace Real Estate Agents
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 

Python Utilities for Managing MySQL Databases

  • 1. <Insert Picture Here> Python Utilities for Managing MySQL Databases Mats Kindahl, Lars Thalmann, Chuck Bell
  • 2. THE FOLLOWING IS INTENDED TO OUTLINE OUR GENERAL PRODUCT DIRECTION. IT IS INTENDED FOR INFORMATION PURPOSES ONLY, AND MAY NOT BE INCORPORATED INTO ANY CONTRACT. IT IS NOT A COMMITMENT TO DELIVER ANY MATERIAL, CODE, OR FUNCTIONALITY, AND SHOULD NOT BE RELIED UPON IN MAKING PURCHASING DECISION. THE DEVELOPMENT, RELEASE, AND TIMING OF ANY FEATURES OR FUNCTIONALITY DESCRIBED FOR ORACLE'S PRODUCTS REMAINS AT THE SOLE DISCRETION OF ORACLE. 2
  • 3. About the Speakers • Mats Kindahl, PhD • Replication Expert and Lead Developer • mats.kindahl@oracle.com • Lars Thalmann, PhD • Development Director, Replication, and Backup • lars.thalmann@oracle.com • Chuck Bell, PhD (not present) • MySQL Utilities and Replication • chuck.bell@oracle.com 3
  • 4. Topics • Introduction to MySQL Utilities • List of current utilities • Architecture of MySQL Utilities • Examples of usage • Using the MySQL Utilities Python Library 4
  • 5. What is MySQL Utilities? • A collection of Python utilities for managing MySQL databases • Part of MySQL Workbench 5.2.31 • Available under the GPLv2 license • Written in Python • Easily enhanced using a growing code library • Goal is to provide a Python library to grow solutions for common administrative problems 5
  • 6. List of Utilities • mysqldbcompare – compare databases • mysqldbcopy – copy databases between servers • mysqldbexport – export metadata and data • mysqldbimport – import metadata and data • mysqldiff – compare object definitions • mysqldiskusage – show disk usage for databases • mysqlindexcheck – check for redundant indexes • mysqlmetagrep – search metadata • mysqlprocgrep – search process information • mysqlreplicate – setup replication • mysqlrplcheck – check replication configuration 6
  • 7. List of Utilities • mysqlserverclone – start a scratch server • mysqlserverinfo – show server information • mysqluc – console for utilities • mysqluserclone – clone a user account 7
  • 8. Utilities in MySQL Workbench • Launch the MySQL Utilities command window: – Click on the Plugins menu item – Select “Start Shell for MySQL Utilities” OR • From the Workbench main window: – Click on the drop down arrow icon to the right of the main window – Scroll through screens to find the MySQL Utilities icon 8
  • 9. How do I access the utilities? 9
  • 10. How do I access the utilities? 10
  • 11. Structure of the MySQL Utilities mysqlprocgrep Scripts Command Common Module Module mysql.utilities.command mysql.utilities.common MySQL Utilities Library 11
  • 12. mysqldbcompare – compare databases • Find missing objects from either database • Find objects that differ in definition • Find differences in data among tables • Print difference in formats differ, ndiff, or context • Print output rows in GRID, TAB, CSV, or VERTICAL formats • Scenarios • checking master and slave for consistency • checking production and development databases for consistency • generating a difference report for expected differences among new and old data • comparing backups for differences 12
  • 13. Sample execution $ mysqldbcompare --server1=root@localhost --server2=root@backup_host:3310 > inventory:inventory --run-all-tests # server1 on localhost: ... connected. # server2 on localhost: ... connected. # Checking databases inventory on server1 and inventory on server2 WARNING: Objects in server1:inventory but not in server2:inventory: VIEW: finishing_up VIEW: cleaning Defn Row Data Type Object Name Diff Count Check --------------------------------------------------------------------------- TABLE supplier pass FAIL FAIL Row counts are not the same among inventory.supplier and inventory.supplier. Data differences found among rows: --- inventory.supplier +++ inventory.supplier @@ -1,2 +1,2 @@ code,name -2,Never Enough Inc. <user>:<password>@<host>:<port>:<socket> +2,Wesayso Corporation 13
  • 14. mysqlmetagrep – search objects • Search for objects with names matching a pattern • Match using SQL patterns or POSIX regular expressions • Search bodies of routines (procedures, events, triggers) • Generate SQL for executing the query – Can be used in applications – Can be stored in events or views _” 14
  • 15. Searching for objects by name Searching a database for objects starting with “t”   mysqlmetagrep ­­pattern="t_" ­­server=mats@localhost $ mysqlmetagrep ­­pattern="t_" ­­server=mats@localhost +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+ | Connection             | Object Type  | Object Name  | Database  | Field Type  | Matches  | +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+ | mats:*@localhost:3307  | TABLE        | t1           | test      | COLUMN      | th       | | mats:*@localhost:3307  | TABLE        | t1           | test      | TABLE       | t1       | | mats:*@localhost:3307  | TABLE        | t2           | test      | TABLE       | t2       | | mats:*@localhost:3307  | TABLE        | tt5          | test      | COLUMN      | t2,t1    | +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­+ 15
  • 16. Searching routine bodies Searching a database for objects containing “l_host” mysqlmetagrep ­­body ­­pattern="%l_host%"   ­­server=mats@localhost $ mysqlmetagrep ­­body ­­pattern="%l_host%" ­­server root@localhost:3307 +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+ | Connection             | Object Type  | Object Name    | Database  | Field Type  | Matches        | +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+ | root:*@localhost:3307  | PROCEDURE    | switch_master  | test      | ROUTINE     | switch_master  | +­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+­­­­­­­­­­­+­­­­­­­­­­­­­+­­­­­­­­­­­­­­­­+ 16
  • 17. mysqlprocgrep – search processes • Search processes on multiple machines • Match by PROCESSLIST fields – Id, State, User, Host, Database, Command, State, Info • Match by age – Find long-running queries, or idle connections • Get SQL for performing the query or action – Put in application – Put in events • Kill queries or connections – Option: ­­kill­query – Option: ­­kill­connection 17
  • 18. Sample usage • Find queries by 'www-data' that have been executing for more than 20 minutes     mysqlprocgrep ­­server=mats@example.com     ­­match­user=www­data     ­­match­state=executing     ­­age=20m  +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ | Connection               | Id  | User  | Host         | Db    | Command  | Time  | State      | Info               | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ | mats:*@example.com:3306  | 53  | mats  | example.com  | user  | Query    | 2040  | executing  | select …           | +­­­­­­­­­­­­­­­­­­­­­­­­­­+­­­­­+­­­­­­­+­­­­­­­­­­­­­­+­­­­­­­+­­­­­­­­­­+­­­­­­­+­­­­­­­­­­­­+­­­­­­­­­­­­­­­­­­­­+ 18
  • 19. Sample usage • Find queries by 'www-data' that have been executing for more than 20 minutes     mysqlprocgrep ­­server=mats@example.com m!     ­­match­user=www­data     ­­match­state=executing The     ­­age=20m ­­kill­query  i ll K 19
  • 20. mysqlreplicate – setup replication • Permits an administrator to start replication among two servers. • User have to provide: – Login information to the slave – Connection information for the master • Example: Setup replication between two instances mysqlreplicate --rpl-user=rpl_user:xyzzy --master=root@localhost:3306 --slave=root@localhost:3307 20
  • 21. mysqluc – MySQL Utilities Console • User defined variables • Help features • Tab completion (names, parameters, options, variables) 21
  • 22. MySQL Utilities Python Library • Major classes for: • Database • Replication • Server • Index • Table • User • Also many helpful methods such as • connect_servers() • setup_common_options() • format_tabular_list() • find_running_servers() 22
  • 23. Library Example • Goal: create a utility that makes a copy of a running server and copies all of the data and users. • Steps • Setup the parameters • Connect to the original server • Find all of the databases • Find all of the users • Make a clone of the original server • Copy all of the databases • Copy all of the users 23
  • 24. Utility options • Server to read from: ­­server • Databases: ­­databases • Data directory for new server: ­­new­data • Port for new server: ­­new­port • Server ID for new server: ­­new­id 24
  • 25. Set up options from optparse import OptionParser parser = OptionParser() parser.add_option("­­server",                   action="store”, dest="server",                   type="string", default="root@localhost:3306",                   help="connection information for original server in "                    "the form: <user>:<password>@<host>:<port>:<socket>") parser.add_option("­d", "­­databases",                   action="store", dest="dbs_to_copy”, type="string",                   help="comma­separated list of databases "                     "to include in the copy (omit for all "                     " databases)”, default=None)            .            .            . 25
  • 26. Library Example • Parse the connection information from mysql.utilities.common.options import parse_connection try: conn = parse_connection(opt.server) except: parser.error("Server connection values invalid or" " cannot be parsed.") • Connect to original server from mysql.utilities.common.server import Server server_options = {'conn_info’ : conn, 'role’ : "source"} srv1 = Server(server_options) srv1.connect() 26
  • 27. Library Example • Find all of the databases db_list = [ (db[0],None) for db in srv1.get_all_databases() ] • Find all of the users _QUERY = """ SELECT user, host FROM mysql.user WHERE user != 'root’ AND user != '' """ users = srv1.exec_query(_QUERY) user_list = [ user[0] + '@' + user[1] for user in users ] 27
  • 28. Library Example • Make a clone of the original server from mysql.utilities.command.serverclone import clone_server res = clone_server(conn, opt.new_data, opt.new_port, opt.new_id, "root", None, False, True) 28
  • 29. Library Example • Copy all of the databases # Set destination server connection parameters from mysql.utilities.command import dbcopy dest = { "user" : conn.get("user"), "passwd" : "root", "host" : conn.get("host"), "port" : opt.new_port, "unix_socket" : os.path.join(opt.new_data, "mysql.sock"), } # Set options for copy options = { "quiet" : True, "force" : True, } dbcopy.copy_db(conn, dest, db_list, options) 29
  • 30. Library Example • Copy all of the users from mysql.utilities.command.userclone import clone_user options = { "overwrite" : True, "quiet" : True, "globals" : True } for user in user_list: res = clone_user(conn, dest_values, user, (user,), options) 30
  • 31. Enhancing the example • Consistent copy? – Locking tables – Consistent snapshot (InnoDB) • Copying all users? – Users not related to the database? – Users with only global privileges? • Automatically start replication • Killing connections? 31
  • 32. Where To Go From Here You can download MySQL Workbench from: http://www.mysql.com/downloads/workbench/ You can also download the latest development source code tree for the MySQL Workbench Utilities from: http://launchpad/net/mysql­utilities 32
  • 33. MySQL High Availability Get it as free ebook: http://oreilly.com/go/ebookrequest Valid this week, mention event “MySQL Replication Update” MySQL Support: www.mysql.com/contact PHP under the hood Thu 10:40am MySQL Technology Update Thu 2:30pm MySQL Binlog API Fri 10:00am Visit MySQL at Oracle booth 701! 33
  • 34. 34