コード例 #1
0
    def page_activated(self, advancing):
        WizardPage.page_activated(self, advancing)

        if advancing:
            supported_types = tuple(
                otype[0] for otype in
                self.main.plan.migrationSource.supportedObjectTypes)
            database_objects = {}
            ui_settings = {}
            for otype in supported_types:
                database_objects[
                    otype] = self.main.plan.migrationSource.selectedObjectsOfType(
                        otype)
                if otype != 'tables' and self.main.plan.migrationSource.rdbms.__id__ != 'com.mysql.rdbms.mysql':
                    ui_settings[otype] = {'group_selected': False}

            if self._scrollpanel:
                self.content.remove(self._scrollpanel)

            self._scrollpanel = mforms.newScrollPanel()
            self.db_selector = DatabaseObjectSelector(supported_types,
                                                      database_objects,
                                                      ui_settings)
            self._scrollpanel.add(self.db_selector)
            self.content.add(self._scrollpanel, True, True)
コード例 #2
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Manual Editing", wide=True)

        self.main.add_wizard_page(self, "ObjectMigration", "Manual Editing")
        self._object_dict = {}
        self._source_objects_with_errors = set()
        self.error_count, self.warning_count = 0, 0
コード例 #3
0
    def page_activated(self, advancing):
        WizardPage.page_activated(self, advancing)

        if advancing:
            self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs

            match_str = r"\%s\.\%s" % (self.main.plan.migrationSource._db_module.quoteIdentifier('(.+)\\'), self.main.plan.migrationSource._db_module.quoteIdentifier('(.+)\\'))
            if self.doesSupportCatalogs > 0:
                catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, schema_name in (re.match(match_str, full_name).groups() 
                                            for full_name in self.main.plan.migrationSource.schemaNames) ]
                self.catalog_schemata = {}
                for catalog_name, schema_name in catalog_schemata_list:
                    self.catalog_schemata.setdefault(catalog_name, []).append(schema_name)
                self.catalog_schemata = self.catalog_schemata.items()
                
                self._optionspanel.show(True)
                #self.advanced_button.show(True)
            else:
                self.catalog_schemata = [ schema_name for catalog_name, schema_name in (re.match(match_str, full_name).groups() 
                                            for full_name in self.main.plan.migrationSource.schemaNames) ]
                self._optionspanel.show(False)
                #self.advanced_button.show(False)

            if self.schema_selector:
                self.content.remove(self.schema_selector)
      
            self.schema_selector = DatabaseSchemaSelector(self.catalog_schemata, tree_checked_callback=self.update_next_button)
            self.content.add(self.schema_selector, True, True)
      
            self.next_button.set_enabled(False)
コード例 #4
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Manual Editing", wide=True)

        self.main.add_wizard_page(self, "ObjectMigration", "Manual Editing")
        self._object_dict = {}
        self._source_objects_with_errors = set()
        self.error_count, self.warning_count = 0, 0
コード例 #5
0
 def go_back(self):
     supported_types = tuple(
         otype[0]
         for otype in self.main.plan.migrationSource.supportedObjectTypes)
     for otype in supported_types:
         self.main.plan.migrationSource.setIgnoredObjectsOfType(otype, {})
     WizardPage.go_back(self)
コード例 #6
0
    def go_next(self):
        self.main.plan.state.objectCreationParams[
            "KeepSchemata"] = self._keep_schema.get_active()

        self.main.plan.state.objectCreationParams[
            "CreateInDB"] = self._create_db.get_active()

        if self._create_script.get_active():
            path = self._create_script_file.get_string_value()
            if not path or not os.path.isdir(os.path.dirname(path)):
                mforms.Utilities.show_error(
                    "Create Script File",
                    "Create Script File option was enabled, but the provided path is invalid.\nPlease correct and retry.",
                    "OK", "", "")
                return

            if os.path.isdir(path):
                mforms.Utilities.show_error(
                    "Create Script File",
                    "'%s' is a directory name. Please provide a file name for saving the script as and retry."
                    % path, "OK", "", "")
                return

            if os.path.exists(path) and self._check_file_duplicate:
                if mforms.Utilities.show_error(
                        "Create Script File",
                        "The file '%s' provided for the SQL script already exists. Do you want to replace it?"
                        % path, "Replace", "Cancel",
                        "") == mforms.ResultCancel:
                    return
            self.main.plan.state.objectCreationParams["CreateSQLFile"] = path
        elif "CreateSQLFile" in self.main.plan.state.objectCreationParams:
            del self.main.plan.state.objectCreationParams["CreateSQLFile"]

        WizardPage.go_next(self)
コード例 #7
0
    def go_next(self):
        try:
            self.main.plan.migrationSource.selectedCatalogName, self.main.plan.migrationSource.selectedSchemataNames = self.schemata_to_migrate(
            )
        except Exception as e:
            mforms.Utilities.show_error("Invalid Selection", str(e), "OK", "",
                                        "")
            return

        def find_selected_option(
        ):  #TODO: When we finally drop py2.5 support substitute this with self.options.index(next(opt for opt in self.options if opt.get_active()))
            for idx, option_radio in enumerate(self.options):
                if option_radio.get_active():
                    return idx
            return None

        if self.doesSupportCatalogs:
            self.main.plan.state.applicationData["schemaMappingMethod"] = [
                "drop_catalog", "drop_schema", "merge_schema"
            ][find_selected_option()]
        else:
            self.main.plan.state.applicationData[
                "schemaMappingMethod"] = "drop_catalog"

        WizardPage.go_next(self)
コード例 #8
0
    def page_activated(self, advancing):
        if advancing:
            if self.main.plan.state.objectCreationParams.get(
                    "CreateInDB", True):
                self._copy_db.set_active(True)
            else:
                self._copy_db.set_active(False)

            self.refresh_table_list()
            for k in self.main.plan.state.dataBulkTransferParams.keys():
                del self.main.plan.state.dataBulkTransferParams[k]

            if sys.platform == "win32":
                filename = mforms.Utilities.get_special_folder(
                    mforms.Desktop) + "\\copy_migrated_tables.cmd"
            else:
                filename = mforms.Utilities.get_special_folder(
                    mforms.Desktop) + "/copy_migrated_tables.sh"
            self.copy_script_entry.set_value(filename)
            self.copy_script_check_duplicate = True

            if self.main.plan.migrationSource.get_os() == "windows":
                bulk_copy_filename = os.path.join(
                    mforms.Utilities.get_special_folder(mforms.Desktop),
                    'bulk_copy_tables.cmd')
            else:
                bulk_copy_filename = os.path.join(
                    mforms.Utilities.get_special_folder(mforms.Desktop),
                    'bulk_copy_tables.sh')
            self.bulk_copy_script_entry.set_value(bulk_copy_filename)
            self.bulk_copy_script_check_duplicate = True

        WizardPage.page_activated(self, advancing)
コード例 #9
0
    def page_activated(self, advancing):
        if advancing:
            if self.main.plan.state.objectCreationParams.get("CreateInDB", True):
                self._copy_db.set_active(True)
            else:
                self._copy_db.set_active(False)

            self.refresh_table_list()
            for k in self.main.plan.state.dataBulkTransferParams.keys():
                del self.main.plan.state.dataBulkTransferParams[k]


            if sys.platform == "win32":
                filename = mforms.Utilities.get_special_folder(mforms.Desktop)+"\\copy_migrated_tables.cmd"
            else:
                filename = mforms.Utilities.get_special_folder(mforms.Desktop)+"/copy_migrated_tables.sh"
            self.CopyScript_entry.set_value(filename)
            self.CopyScript_check_duplicate = True

            source_os = self.main.plan.migrationSource.get_os()
            if not source_os:
                self.BulkCopyScript_radiobutton.set_enabled(False)
                bulk_copy_filename = ''
                grt.send_warning('Cannot get operating system of source server.')
            elif source_os == "windows":
                bulk_copy_filename = os.path.join(mforms.Utilities.get_special_folder(mforms.Desktop), 'bulk_copy_tables.cmd')
            else:
                bulk_copy_filename = os.path.join(mforms.Utilities.get_special_folder(mforms.Desktop), 'bulk_copy_tables.sh')
            self.BulkCopyScript_entry.set_value(bulk_copy_filename)
            self.BulkCopyScript_check_duplicate = True


        WizardPage.page_activated(self, advancing)
コード例 #10
0
    def page_activated(self, advancing):
        WizardPage.page_activated(self, advancing)

        if advancing:
            self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs
            
            if self.doesSupportCatalogs:
                catalog_schemata_list = [ (catalog_name, schema_name) for catalog_name, dot, schema_name in (full_name.rpartition('.') 
                                            for full_name in self.main.plan.migrationSource.schemaNames) ]
                self.catalog_schemata = {}
                for catalog_name, schema_name in catalog_schemata_list:
                    self.catalog_schemata.setdefault(catalog_name, []).append(schema_name)
                self.catalog_schemata = self.catalog_schemata.items()
                
                self._optionspanel.show(True)
                #self.advanced_button.show(True)
            else:
                self.catalog_schemata = [ schema_name for catalog_name, dot, schema_name in (full_name.rpartition('.') 
                                            for full_name in self.main.plan.migrationSource.schemaNames) ]
                self._optionspanel.show(False)
                #self.advanced_button.show(False)

            if self.schema_selector:
                self.content.remove(self.schema_selector)
      
            self.schema_selector = DatabaseSchemaSelector(self.catalog_schemata, tree_checked_callback=self.update_next_button)
            self.content.add(self.schema_selector, True, True)
      
            self.next_button.set_enabled(False)
コード例 #11
0
    def go_next(self):
        self.main.plan.state.objectCreationParams["KeepSchemata"] = self._keep_schema.get_active()

        self.main.plan.state.objectCreationParams["CreateInDB"] = self._create_db.get_active()    

        if self._create_script.get_active():
            path = self._create_script_file.get_string_value()
            if not path or not os.path.isdir(os.path.dirname(path)):
                mforms.Utilities.show_error("Create Script File", "Create Script File option was enabled, but the provided path is invalid.\nPlease correct and retry.",
                                            "OK", "", "")
                return

            if os.path.isdir(path):
                mforms.Utilities.show_error("Create Script File", "'%s' is a directory name. Please provide a file name for saving the script as and retry." % path,
                                            "OK", "", "")
                return

            if os.path.exists(path) and self._check_file_duplicate:
                if mforms.Utilities.show_error("Create Script File", "The file '%s' provided for the SQL script already exists. Do you want to replace it?" % path,
                                            "Replace", "Cancel", "") == mforms.ResultCancel:
                    return
            self.main.plan.state.objectCreationParams["CreateSQLFile"] = path
        elif self.main.plan.state.objectCreationParams.has_key("CreateSQLFile"):
            del self.main.plan.state.objectCreationParams["CreateSQLFile"]
        
        WizardPage.go_next(self)
コード例 #12
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Import Options", wide=True)
     self.layer_name = None
     self.column_list = []
     self.support_spatial_index = Version.fromgrt(
         owner.editor.serverVersion).is_supported_mysql_version_at_least(
             5, 7, 5)
コード例 #13
0
    def __init__(self, main):
        WizardPage.__init__(self, main, 'Schemata Selection')

        self._ui_created = False
        self.main.add_wizard_page(self,  'SourceTarget', 'Schemata Selection')

        optionspanel = mforms.newPanel(mforms.TitledBoxPanel)
        optionspanel.set_title('Schema Name Mapping Method')
        optionsbox = mforms.newBox(False)
        optionsbox.set_padding(8)
        optionsbox.set_spacing(8)
        
        optionsbox.add(mforms.newLabel('Choose how the reverse engineered schemata and objects should be mapped.\n'), False)

        options = [ 'Keep schemata as they are: Catalog.Schema.Table -> Schema.Table',
                    'Only one schema: Catalog.Schema.Table -> Catalog.Table',
                    'Only one schema, keep current schema names as a prefix: Catalog.Schema.Table -> Catalog.Schema_Table',
                  ]
        rid = mforms.RadioButton.new_id()
        self.options = []
        for opt in options:
            radio_button = mforms.newRadioButton(rid)
            radio_button.set_text(opt)
            optionsbox.add(radio_button, False)
            self.options.append(radio_button)
        self.options[1].set_active(True)

        optionspanel.add(optionsbox)
        self._optionspanel = optionspanel
        #self._advanced_shown = False
        #self._optionspanel.show(False)
        self.content.add_end(optionspanel, False)
コード例 #14
0
    def page_activated(self, advancing):
        if advancing:
            if self.main.plan.state.objectCreationParams.get("CreateInDB", True):
                self._copy_db.set_active(True)
            else:
                self._copy_db.set_active(False)

            self.refresh_table_list()
            for k in self.main.plan.state.dataBulkTransferParams.keys():
                del self.main.plan.state.dataBulkTransferParams[k]

            if sys.platform == "win32":
                filename = mforms.Utilities.get_special_folder(mforms.Desktop) + "\\copy_migrated_tables.cmd"
            else:
                filename = mforms.Utilities.get_special_folder(mforms.Desktop) + "/copy_migrated_tables.sh"
            self.copy_script_entry.set_value(filename)
            self.copy_script_check_duplicate = True

            source_os = self.main.plan.migrationSource.get_os()
            if not source_os:
                self.bulk_copy_script_radiobutton.set_enabled(False)
                bulk_copy_filename = ""
                grt.send_warning("Cannot get operating system of source server.")
            elif source_os == "windows":
                bulk_copy_filename = os.path.join(
                    mforms.Utilities.get_special_folder(mforms.Desktop), "bulk_copy_tables.cmd"
                )
            else:
                bulk_copy_filename = os.path.join(
                    mforms.Utilities.get_special_folder(mforms.Desktop), "bulk_copy_tables.sh"
                )
            self.bulk_copy_script_entry.set_value(bulk_copy_filename)
            self.bulk_copy_script_check_duplicate = True

        WizardPage.page_activated(self, advancing)
コード例 #15
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Overview", no_buttons=True)

        self.main = main

        self.main.add_content_page(self, "Overview", "Overview", "migration")
        grt.modules.Workbench.initializeOtherRDBMS()
コード例 #16
0
    def __init__(self, main):
        WizardPage.__init__(self, main, 'Schema Mappings')

        self.main.add_wizard_page(self, 'OBJECT MIGRATION', 'Schema Mappings')

        self.schemata = None
        self.rid = mforms.RadioButton.new_id()
        self.options = []
コード例 #17
0
    def __init__(self, main):
        WizardPage.__init__(self, main, 'Schema Mappings')

        self.main.add_wizard_page(self, 'OBJECT MIGRATION', 'Schema Mappings')

        self.schemata = None
        self.rid = mforms.RadioButton.new_id()
        self.options = []
コード例 #18
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Select File to Import", wide=True)

        self.schema_label = mforms.newLabel("Target schema: ")

        self.back_button.set_enabled(False)
        self.ogrinfo_missing = True
        self.ogr2ogr_missing = True
コード例 #19
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Select File to Import", wide=True)

        self.schema_label = mforms.newLabel("Target schema: ")

        self.back_button.set_enabled(False)
        self.ogrinfo_missing = True
        self.ogr2ogr_missing = True
コード例 #20
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Source Objects")

        self.main.add_wizard_page(self, "ObjectMigration", "Source Objects")
        self._scrollpanel = None
        
        label = mforms.newLabel("You may select the objects to be migrated in the lists below.\nAll tables will be migrated by default.")
        self.content.add(label, False, True)
コード例 #21
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Migration Report")

        self.main.add_wizard_page(self, "Report", "Migration Report")

        self._report = mforms.newTextBox(mforms.VerticalScrollBar)
        self.content.add(self._report, True, True)
        
        self.next_button.set_text("Finish")
コード例 #22
0
 def page_activated(self, advancing):
     if advancing:
         self.generate_migration_report()
         if "GenerateBulkCopyScript" in self.main.plan.state.dataBulkTransferParams.keys():
             self.advanced_button.set_text("Open folder that contains generated script")
             self.advanced_button.show(True)
         else:
             self.advanced_button.show(False)
     WizardPage.page_activated(self, advancing)
コード例 #23
0
 def page_activated(self, advancing):
     if advancing:
         self.generate_migration_report()
         if "GenerateBulkCopyScript" in self.main.plan.state.dataBulkTransferParams.keys():
             self.advanced_button.set_text("Open folder that contain generated script")
             self.advanced_button.show(True)
         else:
             self.advanced_button.show(False)
     WizardPage.page_activated(self, advancing)
コード例 #24
0
ファイル: migration_summary.py プロジェクト: juanga16/p111mil
    def __init__(self, main):
        WizardPage.__init__(self, main, "Migration Report")

        self.main.add_wizard_page(self, "REPORT", "Migration Report")

        self._report = mforms.newTextBox(mforms.VerticalScrollBar)
        self.content.add(self._report, True, True)

        self.next_button.set_text("Finish")
コード例 #25
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Source Objects")

        self.main.add_wizard_page(self, "ObjectMigration", "Source Objects")
        self._scrollpanel = None

        label = mforms.newLabel(
            "You may select the objects to be migrated in the lists below.\nAll tables will be migrated by default."
        )
        self.content.add(label, False, True)
コード例 #26
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Target Creation Options")

        self.main.add_wizard_page(self, "ObjectMigration", "Target Creation Options")

        label = mforms.newLabel("Select options for the creation of the migrated schema in the target\nMySQL server and click [Next >] to execute.")
        self.content.add(label, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Schema Creation")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)

        self._create_db = mforms.newCheckBox()
        self._create_db.set_text("Create schema in target RDBMS")
        box.add(self._create_db, False, True)

        # spacer
        box.add(mforms.newLabel(""), False, True)

        self._create_script = mforms.newCheckBox()
        self._create_script.set_text("Create a SQL script file")
        self._create_script.add_clicked_callback(self._toggle_sql_script)
        box.add(self._create_script, False, True)
        self._file_hbox = mforms.newBox(True)
        self._file_hbox.set_spacing(4)
        self._file_hbox.add(mforms.newLabel("Script File:"), False, True)
        self._create_script_file = mforms.newTextEntry()
        self._create_script_file.set_value(os.path.join(os.path.expanduser('~'), 'migration_script.sql'))
        self._file_hbox.add(self._create_script_file, True, True)
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(self._browse_files)
        self._file_hbox.add(button, False, True)
        box.add(self._file_hbox, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Options")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)
        box.set_spacing(8)

        self._keep_schema = mforms.newCheckBox()
        self._keep_schema.set_text("Keep schemas if they already exist. Objects that already exist will not be recreated or updated.")
        box.add(self._keep_schema, False, True)

        self._create_db.set_active(True)
        self._toggle_sql_script()
        self._check_file_duplicate = True
コード例 #27
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Target Creation Options")

        self.main.add_wizard_page(self, "OBJECT MIGRATION", "Target Creation Options")

        label = mforms.newLabel("Select options for the creation of the migrated schema in the target\nMySQL server and click [Next >] to execute.")
        self.content.add(label, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Schema Creation")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)

        self._create_db = mforms.newCheckBox()
        self._create_db.set_text("Create schema in target RDBMS")
        box.add(self._create_db, False, True)

        # spacer
        box.add(mforms.newLabel(""), False, True)

        self._create_script = mforms.newCheckBox()
        self._create_script.set_text("Create a SQL script file")
        self._create_script.add_clicked_callback(self._toggle_sql_script)
        box.add(self._create_script, False, True)
        self._file_hbox = mforms.newBox(True)
        self._file_hbox.set_spacing(4)
        self._file_hbox.add(mforms.newLabel("Script File:"), False, True)
        self._create_script_file = mforms.newTextEntry()
        self._create_script_file.set_value(os.path.join(os.path.expanduser('~'), 'migration_script.sql'))
        self._file_hbox.add(self._create_script_file, True, True)
        button = mforms.newButton()
        button.set_text("Browse...")
        button.add_clicked_callback(self._browse_files)
        self._file_hbox.add(button, False, True)
        box.add(self._file_hbox, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("Options")
        self.content.add(panel, False, True)

        box = mforms.newBox(False)
        panel.add(box)
        box.set_padding(12)
        box.set_spacing(8)

        self._keep_schema = mforms.newCheckBox()
        self._keep_schema.set_text("Keep schemata if they already exist. Objects that already exist will not be recreated or updated.")
        box.add(self._keep_schema, False, True)

        self._create_db.set_active(True)
        self._toggle_sql_script()
        self._check_file_duplicate = True
コード例 #28
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Select output file location")
     if self.main.formats:
         self.active_module = self.main.formats[0] # We set first module as the active one
     else:
         self.active_module = None
     self.unsupported_output_format = False
     self.confirm_file_overwrite = False
     self.radio_opts = []
     self.optbox = None
     self.destination_file_checked = False
コード例 #29
0
 def go_next(self):
     if self._error_tables:
         r = mforms.Utilities.show_warning("Table Creation Errors",
                 "Some tables could not be created in the target database.\nWould you like to flag them to be skipped and copy the data for the remaining tables only?",
                 "Skip Failed Tables", "Cancel", "")
         if r == mforms.ResultOk:
             for table in self._error_tables:
                 table.commentedOut = 1
         else:
             return
     
     WizardPage.go_next(self)
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Migration(s)')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save Migration(s) to Folder...')
        self.save_button.set_tooltip('Select the folder to save your migration(s) to.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #31
0
 def go_next(self):
     if self._error_tables:
         r = mforms.Utilities.show_warning("Table Creation Errors",
                 "Some tables could not be created in the target database.\nWould you like to flag them to be skipped and copy the data for the remaining tables only?",
                 "Skip Failed Tables", "Cancel", "")
         if r == mforms.ResultOk:
             for table in self._error_tables:
                 table.commentedOut = 1
         else:
             return
     
     WizardPage.go_next(self)
コード例 #32
0
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Migration(s)')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save Migration(s) to Folder...')
        self.save_button.set_tooltip('Select the folder to save your migration(s) to.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #33
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Configure Import Settings", wide=True)
     
     self.last_analyze_status = False
     self.input_file_type = 'csv'
     self.active_module = self.main.formats[0] # csv
     self.encoding_list = {'cp1250 (windows-1250)':'cp1250', 
                           'latin2 (iso8859-2)':'iso8859_2', 
                           'latin1 (iso8859-1)':'latin_1', 
                           'utf-8':'utf-8', 
                           'utf-16':'utf-16'}
     self.dest_cols = []
     self.column_mapping = []
     self.ds_show_count = 0
     self.df_show_count = 0
     self.opts_mapping = {}
コード例 #34
0
    def go_next(self):
        i = self._worker_count.get_string_value()
        try:
            count = int(i)
            if count < 1:
                raise Exception("Bad value")
        except Exception:
            mforms.Utilities.show_error("Invalid Value", "Worker thread count must be a number larger than 0.", "OK", "", "")
            return
        self.main.plan.state.dataBulkTransferParams["workerCount"] = count
        #if self.dump_to_file.get_active():
        #   self.main.plan.state.dataBulkTransferParams["GenerateDumpScript"] = self.dump_to_file_entry.get_string_value()
        #else:
        #    if "GenerateDumpScript" in self.main.plan.state.dataBulkTransferParams:
        #       del self.main.plan.state.dataBulkTransferParams["GenerateDumpScript"]

        if self.copy_script_checkbox.get_active():
            self.main.plan.state.dataBulkTransferParams["GenerateCopyScript"] = self.copy_script_entry.get_string_value()
        else:
            if self.main.plan.state.dataBulkTransferParams.has_key("GenerateCopyScript"):
                del self.main.plan.state.dataBulkTransferParams["GenerateCopyScript"]

        self.main.plan.state.dataBulkTransferParams["LiveDataCopy"] = 1 if self._copy_db.get_active() else 0
        self.main.plan.state.dataBulkTransferParams["DebugTableCopy"] = 1 if self._debug_copy.get_active() else 0
        self.main.plan.state.dataBulkTransferParams["TruncateTargetTables"] = 1 if self._truncate_db.get_active() else 0

        for key in self.main.plan.state.dataBulkTransferParams.keys():
            if key.endswith(":rangeKey"):
                del self.main.plan.state.dataBulkTransferParams[key]
            if key.endswith(":rangeStart"):
                del self.main.plan.state.dataBulkTransferParams[key]
            if key.endswith(":rangeEnd"):
                del self.main.plan.state.dataBulkTransferParams[key]
            if key.endswith(":rowCount"):
                del self.main.plan.state.dataBulkTransferParams[key]

        tables_to_copy = []
        for row in range(self._tree.count()):
            n = self._tree.node_at_row(row)
            table = self._tables_by_id[n.get_tag()]

            count = n.get_string(1)
            if not count:
                tables_to_copy.append(table)
            else:
                try:
                    count = int(count)
                    if count > 0:
                        # tables_to_copy.append(table)
                        self.main.plan.state.dataBulkTransferParams["%s:rowCount" % table.__id__] = count
                except:
                    grt.log_error("Invalid value in Migration DataCopy tree: %s"%count)

        self.main.plan.state.dataBulkTransferParams["tableList"] = tables_to_copy

        if self._copy_db.get_active() or self.copy_script_checkbox.get_active():
            return WizardPage.go_next(self)
        else:
            self.main.go_next_page(2)
            return
コード例 #35
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Migration Options")

        self.main.add_wizard_page(self, "ObjectMigration", "Migration Options")

        label = mforms.newLabel("Select options for the migration of the source schema/schemas to MySQL.")
        self.content.add(label, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("DBMS Specific Options")
        self.content.add(panel, False, True)

        self._db_options_box = mforms.newBox(False)
        panel.add(self._db_options_box)
        self._db_options_box.set_padding(12)
        self._db_options_box.set_spacing(8)
        self._db_options = []
コード例 #36
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Configure Import Settings", wide=True)
     
     self.last_analyze_status = False
     self.input_file_type = 'csv'
     self.active_module = self.main.formats[0] # csv
     self.encoding_list = {'cp1250 (windows-1250)':'cp1250', 
                           'latin2 (iso8859-2)':'iso8859_2', 
                           'latin1 (iso8859-1)':'latin_1', 
                           'utf-8':'utf-8', 
                           'utf-16':'utf-16'}
     self.dest_cols = []
     self.column_mapping = []
     self.ds_show_count = 0
     self.df_show_count = 0
     self.opts_mapping = {}
     self.is_server_5_7 = Version.fromgrt(self.main.editor.serverVersion).is_supported_mysql_version_at_least(Version.fromstr("5.7.5"))
コード例 #37
0
    def __init__(self, main):
        WizardPage.__init__(self, main, "Migration Options")

        self.main.add_wizard_page(self, "ObjectMigration", "Migration Options")

        label = mforms.newLabel("Select options for the migration of the source schema/schemata to MySQL.")
        self.content.add(label, False, True)

        panel = mforms.newPanel(mforms.TitledBoxPanel)
        panel.set_title("DBMS Specific Options")
        self.content.add(panel, False, True)

        self._db_options_box = mforms.newBox(False)
        panel.add(self._db_options_box)
        self._db_options_box.set_padding(12)
        self._db_options_box.set_spacing(8)
        self._db_options = []
コード例 #38
0
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Script')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save to File...')
        self.save_button.set_tooltip('Save the text to a new file.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.copy_button = mforms.newButton()
        self.copy_button.enable_internal_padding(True)
        self.copy_button.set_text('Copy to Clipboard')
        self.copy_button.set_tooltip('Copy the text to the clipboard.')
        self.copy_button.add_clicked_callback(self.copy_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #39
0
    def __init__(self, owner, sql_text):
        WizardPage.__init__(self, owner, 'Review Generated Script')

        self.save_button = mforms.newButton()
        self.save_button.enable_internal_padding(True)
        self.save_button.set_text('Save to File...')
        self.save_button.set_tooltip('Save the text to a new file.')
        self.save_button.add_clicked_callback(self.save_clicked)

        self.copy_button = mforms.newButton()
        self.copy_button.enable_internal_padding(True)
        self.copy_button.set_text('Copy to Clipboard')
        self.copy_button.set_tooltip('Copy the text to the clipboard.')
        self.copy_button.add_clicked_callback(self.copy_clicked)

        self.sql_text = mforms.newCodeEditor()
        self.sql_text.set_language(mforms.LanguageMySQL)
        self.sql_text.set_text(sql_text)
コード例 #40
0
    def page_activated(self, advancing):
        WizardPage.page_activated(self, advancing)

        if advancing:
            supported_types = tuple(otype[0] for otype in self.main.plan.migrationSource.supportedObjectTypes)
            database_objects = {}
            ui_settings = {}
            for otype in supported_types:
                database_objects[otype] = self.main.plan.migrationSource.selectedObjectsOfType(otype)
                if otype != 'tables' and self.main.plan.migrationSource.rdbms.__id__ != 'com.mysql.rdbms.mysql':
                    ui_settings[otype] = { 'group_selected' : False }

            if self._scrollpanel:
                self.content.remove(self._scrollpanel)

            self._scrollpanel = mforms.newScrollPanel()
            self.db_selector = DatabaseObjectSelector(supported_types, database_objects, ui_settings)
            self._scrollpanel.add(self.db_selector)
            self.content.add(self._scrollpanel, True, True)
コード例 #41
0
    def page_activated(self, advancing):
        WizardPage.page_activated(self, advancing)

        if advancing:
            self.doesSupportCatalogs = self.main.plan.migrationSource.rdbms.doesSupportCatalogs

            match_str = r"\%s\.\%s" % (self.main.plan.migrationSource.
                                       _db_module.quoteIdentifier('(.+)\\'),
                                       self.main.plan.migrationSource.
                                       _db_module.quoteIdentifier('(.+)\\'))
            if self.doesSupportCatalogs > 0:
                catalog_schemata_list = [
                    (catalog_name, schema_name)
                    for catalog_name, schema_name in (
                        re.match(match_str, full_name).groups() for full_name
                        in self.main.plan.migrationSource.schemaNames)
                ]
                self.catalog_schemata = {}
                for catalog_name, schema_name in catalog_schemata_list:
                    self.catalog_schemata.setdefault(catalog_name,
                                                     []).append(schema_name)
                self.catalog_schemata = self.catalog_schemata.items()

                self._optionspanel.show(True)
                #self.advanced_button.show(True)
            else:
                self.catalog_schemata = [
                    schema_name for catalog_name, schema_name in (
                        re.match(match_str, full_name).groups() for full_name
                        in self.main.plan.migrationSource.schemaNames)
                ]
                self._optionspanel.show(False)
                #self.advanced_button.show(False)

            if self.schema_selector:
                self.content.remove(self.schema_selector)

            self.schema_selector = DatabaseSchemaSelector(
                self.catalog_schemata,
                tree_checked_callback=self.update_next_button)
            self.content.add(self.schema_selector, True, True)

            self.next_button.set_enabled(False)
コード例 #42
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Generate certificates and self-signed keys")

        self.ca_cert = os.path.join(self.main.results_path, "ca-cert.pem").replace('\\', '/')
        self.server_cert = os.path.join(self.main.results_path, "server-cert.pem").replace('\\', '/')
        self.server_key = os.path.join(self.main.results_path, "server-key.pem").replace('\\', '/')
        self.client_cert = os.path.join(self.main.results_path, "client-cert.pem").replace('\\', '/')
        self.client_key = os.path.join(self.main.results_path, "client-key.pem").replace('\\', '/')

        self.table = mforms.newTable()
        self.table.set_padding(12)
        self.table.set_column_count(3)
        self.table.set_row_count(7)

        self.table.set_row_spacing(8)
        self.table.set_column_spacing(4)

        row, self.country_code = self.add_label_row(0, "Country:", "2 letter country code (eg, US)")
        row, self.state_name = self.add_label_row(row, "State or Province:", "Full state or province name")
        row, self.locality_name = self.add_label_row(row, "Locality:", "eg, city")
        row, self.org_name = self.add_label_row(row, "Organization:", "eg, company")
        row, self.org_unit = self.add_label_row(row, "Org. Unit:", "eg, section, department")
        row, self.email_address = self.add_label_row(row, "Email Address:", "")
        row, self.common_name = self.add_label_row(row, "Common:", "eg, put the FQDN of the server\nto allow server address validation")

        message = "Now you must specify the parameters to use in the certificates and self-signed key generation.\n"
        message += "This may include some data refering to youself and/or the company you work for. All fields are optional."
        
        self.parameters_box = mforms.newBox(False)
        self.parameters_box.set_padding(20)
        self.parameters_box.set_spacing(20)

        self.parameters_label = mforms.newLabel(message)
        
        self.parameters_panel = mforms.newPanel(mforms.TitledBoxPanel)
        self.parameters_panel.set_title("Optional Parameters")
        self.parameters_panel.add(self.table)
        
        self.parameters_box.add(self.parameters_label, False, False)
        self.parameters_box.add(self.parameters_panel, False, False)

        self.default_label = mforms.newLabel("The wizard is ready to generate the files for you. Click 'Next >' to generate \nthe certificates and self-signed key files...")
コード例 #43
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Generate certificates and self-signed keys")

        self.ca_cert = os.path.join(self.main.results_path, "ca-cert.pem")
        self.server_cert = os.path.join(self.main.results_path, "server-cert.pem")
        self.server_key = os.path.join(self.main.results_path, "server-key.pem")
        self.client_cert = os.path.join(self.main.results_path, "client-cert.pem")
        self.client_key = os.path.join(self.main.results_path, "client-key.pem")

        self.table = mforms.newTable()
        self.table.set_padding(12)
        self.table.set_column_count(3)
        self.table.set_row_count(7)

        self.table.set_row_spacing(8)
        self.table.set_column_spacing(4)

        row, self.country_code = self.add_label_row(0, "Country:", "2 letter country code (eg, US)")
        row, self.state_name = self.add_label_row(row, "State or Province:", "Full state or province name")
        row, self.locality_name = self.add_label_row(row, "Locality:", "eg, city")
        row, self.org_name = self.add_label_row(row, "Organization:", "eg, company")
        row, self.org_unit = self.add_label_row(row, "Org. Unit:", "eg, section, department")
        row, self.email_address = self.add_label_row(row, "Email Address:", "")
        row, self.common_name = self.add_label_row(row, "Common:", "eg, put the FQDN of the server\nto allow server address validation")

        message = "Now you must specify the parameters to use in the certificates and self-signed key generation.\n"
        message += "This may include some data refering youself and/or the company you work for. All fields are optional."
        
        self.parameters_box = mforms.newBox(False)
        self.parameters_box.set_padding(20)
        self.parameters_box.set_spacing(20)

        self.parameters_label = mforms.newLabel(message)
        
        self.parameters_panel = mforms.newPanel(mforms.TitledBoxPanel)
        self.parameters_panel.set_title("Optional Parameters")
        self.parameters_panel.add(self.table)
        
        self.parameters_box.add(self.parameters_label, False, False)
        self.parameters_box.add(self.parameters_panel, False, False)

        self.default_label = mforms.newLabel("The wizard is ready to generate the files for you. Click 'Next >' to generate \nthe certificates and self-signed key files...")
コード例 #44
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Options")
        
        self.generate_files = newCheckBox()
        self.generate_files.set_text("Generate new certificates and self-signed keys");
        self.generate_files.set_active(False if self.check_all_files_availability() == True else True)
        self.generate_files.set_enabled(self.check_all_files_availability())

        self.update_connection = newCheckBox()
        self.update_connection.set_text("Update the connection");
        self.update_connection.set_active(True)

        self.use_default_parameters = newCheckBox()
        self.use_default_parameters.set_text("Use default parameters");
        self.use_default_parameters.set_active(False)
        
        self.clear_button = newButton()
        self.clear_button.set_text("Clear")
        self.clear_button.add_clicked_callback(self.clear_button_clicked)
        self.clear_button.set_enabled(os.path.isdir(self.main.results_path))
コード例 #45
0
    def __init__(self, owner):
        WizardPage.__init__(self, owner, "Options")
        
        self.generate_files = newCheckBox()
        self.generate_files.set_text("Generate new certificates and self-signed keys");
        self.generate_files.set_active(not self.check_all_files_availability())
        self.generate_files.set_enabled(self.check_all_files_availability())

        self.update_connection = newCheckBox()
        self.update_connection.set_text("Update the connection");
        self.update_connection.set_active(True)

        self.use_default_parameters = newCheckBox()
        self.use_default_parameters.set_text("Use default parameters");
        self.use_default_parameters.set_active(False)
        
        self.clear_button = newButton()
        self.clear_button.set_text("Clear")
        self.clear_button.add_clicked_callback(self.clear_button_clicked)
        self.clear_button.set_enabled(os.path.isdir(self.main.results_path))
コード例 #46
0
    def page_activated(self, advancing):
        if advancing:
            if self.main.plan.state.objectCreationParams.get("CreateInDB", True):
                self._copy_db.set_active(True)
            else:
                self._copy_db.set_active(False)

            self.refresh_table_list()
            for k in self.main.plan.state.dataBulkTransferParams.keys():
                del self.main.plan.state.dataBulkTransferParams[k]


            if sys.platform == "win32":
                filename = mforms.Utilities.get_special_folder(mforms.Desktop)+"\\copy_migrated_tables.cmd"
            else:
                filename = mforms.Utilities.get_special_folder(mforms.Desktop)+"/copy_migrated_tables.sh"
            self.copy_script_entry.set_value(filename)
            self.copy_script_check_duplicate = True


        WizardPage.page_activated(self, advancing)
コード例 #47
0
    def page_advanced(self, advancing):
        if advancing:
            for item, name, getter in self._db_options:
                self._db_options_box.remove(cont)

            if hasattr(self.main.plan.migrationSource.module_re(), "migrationOptions"):
                options = self.main.plan.migrationSource.module_re().migrationOptions(self.main.plan.state)
  
                self._db_options = self.create_options(self._db_options_box, options)
                if not self._db_options:
                    self._db_options_box.show(False)
                else:
                    self._db_options_box.show(True)
    
        return WizardPage.page_advanced(self, advancing)
コード例 #48
0
    def page_advanced(self, advancing):
        if advancing:
            for item, name, getter in self._db_options:
                self._db_options_box.remove(item)

            if hasattr(self.main.plan.migrationSource.module_re(), "migrationOptions"):
                options = self.main.plan.migrationSource.module_re().migrationOptions(self.main.plan.state)
  
                self._db_options = self.create_options(self._db_options_box, options)
                if not self._db_options:
                    self._db_options_box.show(False)
                else:
                    self._db_options_box.show(True)
    
        return WizardPage.page_advanced(self, advancing)
コード例 #49
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Results")
     self.update_connection = True
コード例 #50
0
 def __init__(self, owner):
     WizardPage.__init__(self, owner, "Welcome to MySQL Workbench SSL Wizard")
コード例 #51
0
 def page_activated(self, advance):
     WizardPage.page_activated(self, advance)
     if advance:
         self._filter_changed()
         self.refresh()
コード例 #52
0
 def page_activated(self, advance):
     WizardPage.page_activated(self, advance)
     if advance:
         self._filter_changed()
         self.refresh()
コード例 #53
0
 def go_next(self):
     if self.validate():
         self.main.plan.migrationUpdate()
         WizardPage.go_next(self)
コード例 #54
0
 def go_next(self):
     dic = self.main.plan.state.objectMigrationParams
     for item, name, getter in self._db_options:
         dic[name] = getter()
     WizardPage.go_next(self)
コード例 #55
0
 def go_next(self):
     if self.validate():
         self.main.plan.migrationUpdate()
         WizardPage.go_next(self)