Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:19:33+00:00 2026-05-23T17:19:33+00:00

The object ‘wb’ (and, obviously, all superior objects) loads and holds information, but the

  • 0

The object ‘wb’ (and, obviously, all superior objects) loads and holds information, but the tree to get at the database’s physical model is simply not loading. Internet searching got me bipkis, thus far.

(I was intending to write a routine to test for the existence of certain columns and add the appropriate trigger programatically. I’ve worked out a kludge using a regular expression and a database export, but this rankles a bit.)

Missing some form of simple activation? (connection perhaps)

The following fails with the error “AttributeError: ‘NoneType’ object has no attribute ‘physicalModels'”:

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

import grt
#import mforms #??
stOut=""
stTrigger="""
delimiter $$ 
create trigger `docdb_mk2`.tsi_{t} before insert on `docdb_mk2`.`{t}` 
for each row begin
set new.inserted=now();
end$$"""

# iterate through all tables from schema"""
schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0]
for table in schema.tables:
    #print table.name
    #if table. 
    #check to make sure both inserted and Updated are in the table
    #Since I have no clue how to do that in here, I'll skip it for now.
    stOut=stOut+stTrigger(t=table.name)

Even this fails:

# -*- coding: utf-8 -*-
# MySQL Workbench Python script
# <description>
# Written in MySQL Workbench 5.2.34
import grt
#import mforms
# iterate through all schemas

for schema in grt.root.wb.doc.physicalModels[0].catalog.schemata:
    print schema.name

Please note that I’m not asking for advice on my SQL at the moment, just on this irritating barrier in scripting.

Edit: Apparently, some of the objects load by loading up those elements in the UI. If there is some way of getting them to load elseways, I’d appreciate knowing, but it does seem that if you load the scripting module from the main Workbench screen, you get a partially initialized wb object. If you load the thing from a different subsystem, such as the data modeling module, (Scripting > Run Workbench Script File…) other parts are loaded and begin to work. Hmm.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:19:34+00:00Added an answer on May 23, 2026 at 5:19 pm

    While this is not a complete solution this is my work in progress on trying to figure this out as well. From what I can tell the wb.docs.physicalModels object is only available when in ‘design/model’ mode, what I need to do it run a script in SQL Editor mode. The code below does execute queries and returns results, but I’m struggling with documentation not matching what I’m seeing in the objects right now. Hopefully this is of some help

    import grt
    
    for editor in grt.root.wb.sqlEditors:
        # add some text to the 'Output' tab
        editor.addToOutput("Test", 0)
    
        results = editor.executeScript("show tables")
        #print results.rowCount()
        # the above throws an exception because what is returned from executeScript() differs from the docs
        print results
    
        for buffer in editor.queryBuffers:
            print buffer.replaceContents("test")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What object do you query against to select all the table names in a
The object I’m working on is instantiated in JavaScript, but used in VBScript. In
object here should refer to the Object class. As with all class identifiers in
Object-Oriented programmers seem to have all the fun. Not only are they treated to
Good object-oriented design says that objects should not expose their internals. Given this is
What object types are best for writing unit tests for generic collections? Obviously if
Object-oriented design encourages the use of immutable objects to improve thread-safety and performance. I'm
Object ele=a.get(i); if(ele instanceof java.lang.Integer){//cast to integer: print(found Int); }else{ //cast to string: print(found:
Object A { def a = { something} } // I've import A, but
Object Site has collection of objects Tag . Object Tag has property Title .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.