Install and configure Rahl Commander.

  • Install Python 3.4 and above
  • Install python Mysql connector
  • Download source for Rahl Commander from github. I try to leave the trunk in a stable condition all the time. So it is a safe bet, Or, choose the latest stable release.
  • Extract the source code in a place you can access it from the command line and use the command line python. Cd to the bin directory of Rahl Commander and type python If you get the interactive python tool, you are good to go.
  • copy or rename the folder example_config to config. KEEP IT UNDER THE PARENT FOLDER OF RAHL COMMANDER
  • cd to the config folder and open the __init__.py file.
  • The file is pretty self explanatory. Below I will mark with bold reds which values you can modify. Do notice all the config values can be overriden from the command line (explained in the usage manuall ????link????)
    import sys
    import os
    import logging
    from config.ignore_list import ignore_files_dirs_with
    from config.common_language import help_common_language
    from config.autocomplete import autocomplete
    #
    #
    DEBUG = True #you can leave this as is, it is mostly for developers of this module
    #
    #
    # Mysql config
    mysql = {
          'host':'localhost',
          'username':'root',
          'password':'somepassword'} #your database credentials # # # Assets CHANGE HERE if u want the assets folder to be somewhere else # Here you can put absolute values (a full string) # or a use python function, like in this example. assets_folder = os.path.abspath('../example_assets') # # # Logger setup values. logman = {'default_log_level': logging.DEBUG}
  • Installing the upgrades module The Upgrades module requires a table in mysql to store it’s data. Select a database where you put this table, and run this query:
    CREATE TABLE rcom_sql_upgrades ( 
    file_name varchar(255) CHARACTER SET utf8 NOT NULL, execute_order INT(11) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'if file is prefixed with a number it goes here and determines execution order of sqls',
    time_runned timestamp NULL DEFAULT NULL,
    execution_status enum('pending_completion','failed','failed_in_test','completed','completed_in_test') CHARACTER SET utf8 NOT NULL DEFAULT 'pending_completion',
    error_message varchar(255) CHARACTER SET utf8 DEFAULT NULL,
    PRIMARY KEY (file_name) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
    

    Open under the config folder the file upgrade.py. Enter the name of the database you ran the query above for the upgrade_tracking_database field.
    So, if your db name was app_meta_tracking_db, The file should look like this:

    upgrade = {   'upgrade_tracking_database': 'app_meta_tracking_db',                 \
                  'test_host':                 '',             \
                  'test_user':                 '',                  \
                  'test_password':             '',                      \
                  'force_test':                False,                    \
                  'force_schema_test':         False}
    
    

    The rest of the values will be covered in the Upgrades module tutorial.

  • The folder example_assets is an example of how a assets folder is organized. Copy that structure into your own project source. This is where you write your stored procedures, views, triggers, schema rules etc. This is your code to be tracked in your own source control and not in Rahl Commander. In the config above, point the assets_folder to where your assets folder is going to be located. As a side note, when running any of RCOM commands, you can specify on the fly the location of the assets folder. In such cases, the value in the config file will be ignored.
  • cd to the bin folder of Rahl Commander and run the test.
    python test.py -vv --all
    

    Read the output, as it tells you about the quality of your installation. Most likely, the first error would be about your mysql server not found. Either you forgot to turn it on, or the credentials in the config above, are not correct.
    If you do not have any assets, the message would be (I am using the path to my own asets folder here):

    start
    
    INFO:root:Trying to connect to root:123456!!@localhost
    ********************************************************************************
                                                   START
    ********************************************************************************
    
    Using values from config folder!
    
     GOOD! autocompletion folder found [/home/admin/dev/omega_supremo/autocompletion]
     GOOD! autocompletion folder found for PHP [/home/admin/dev/omega_supremo/autocompletion/php].
     GOOD! scripts folder found [/home/admin/dev/omega_supremo/scripts]
     GOOD! Schema Checker folder found [/home/admin/dev/omega_supremo/schema]
     GOOD! folder [/home/admin/dev/omega_supremo/functions] was found
     GOOD! folder [/home/admin/dev/omega_supremo/sp] was found
     GOOD! folder [/home/admin/dev/omega_supremo/views] was found
     GOOD! folder [/home/admin/dev/omega_supremo/triggers] was found
     GOOD! folder [/home/admin/dev/omega_supremo/scripts] was found
     GOOD! folder [/home/admin/dev/omega_supremo/schema] was found
    
    
    ********************************************************************************
    NOW! I will test all dbs, you try to work with, exists
    ********************************************************************************
    
    
    
    
    
    ********************************************************************************
    Checking SQL UPGRADES config values
    ********************************************************************************
     GOOD! ['.md'] found in file ignore list under config/ignore_list.py
     GOOD: table rcom_sql_upgrades was found
    
     

    NOTICE! there is nothing in the NOW! I will test all dbs, you try to work with, exists section. Once you add objects in those folders, it will output the database names you are working with (how, in the next post).
    If you get a different strange error, it seems you did not configure/installed the system properly. Feel free to post the message here, or send it to me on Github and I’ll help.

NEXT: “How to use the DB Objects Builder” Which explains assets folders structure for this module and the associated commands RCOM provides.

1 thought on “Install and configure Rahl Commander.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close