Nov 5, 2017

Run Python script in MySQL Workbench

Run Python script in MySQL Workbench

  1. Start MySQLWorkbench
  2. connect to local database
  3. select sakila from SCHEMAS
  4. start scripting shell with Tools->scripting shell or (Ctrl+F3)
  5. Add new python script (test.py)
  6. Save script with the content below
  7. run script in scripting shell

# -*- coding: utf-8 -*-
# MySQL Workbench Python script
# <description>
# Written in MySQL Workbench 6.3.6

import grt
#import mforms
result = grt.root.wb.sqlEditors[0].executeScript("select * from contacts limit 8;")

for col in result[0].columns:
    print col.name

Post a Comment

Featured Post

DMARC is a type of email authentication protocol that leverages the widely used SPF and DKIM protocols to improve a sender’s understanding of how their email in circulation is processed.

Email claiming to be from their domain is analyzed by receiving organizations and a digest of acceptance/failures is sent back to the sende...