ensembl-hive  2.1
 All Classes Namespaces Files Functions Pages
Bio::EnsEMBL::Hive::RunnableDB::SqlCmd Class Reference
+ Inheritance diagram for Bio::EnsEMBL::Hive::RunnableDB::SqlCmd:
+ Collaboration diagram for Bio::EnsEMBL::Hive::RunnableDB::SqlCmd:

Public Member Functions

public strict_hash_format ()
 
public fetch_input ()
 
public run ()
 
public write_output ()
 
- Public Member Functions inherited from Bio::EnsEMBL::Hive::Process
public new ()
 
public life_cycle ()
 
public say_with_header ()
 
public enter_status ()
 
public warning ()
 
public strict_hash_format ()
 
public param_defaults ()
 
public fetch_input ()
 
public run ()
 
public write_output ()
 
public Bio::EnsEMBL::Hive::Worker worker ()
 
public Boolean execute_writes ()
 
public
Bio::EnsEMBL::Hive::DBSQL::DBAdaptor 
db ()
 
public
Bio::EnsEMBL::Hive::DBSQL::DBConnection 
dbc ()
 
public
Bio::EnsEMBL::Hive::DBSQL::DBConnection 
data_dbc ()
 
public
Bio::EnsEMBL::Hive::AnalysisJob 
input_job ()
 
public input_id ()
 
public param ()
 
public param_required ()
 
public param_is_defined ()
 
public param_substitute ()
 
public dataflow_output_id ()
 
public throw ()
 
public complete_early ()
 
public Int debug ()
 
public worker_temp_directory ()
 
public worker_temp_directory_name ()
 
public cleanup_worker_temp_directory ()
 

Detailed Description

Synopsis

standaloneJob.pl Bio::EnsEMBL::Hive::RunnableDB::SqlCmd --db_conn mysql://ensadmin:${ENSADMIN_PSW}@127.0.0.1:2912/lg4_compara_families_64 \
--sql "INSERT INTO meta(meta_key,meta_value) VALUES ('Hello', 'world')"
standaloneJob.pl Bio::EnsEMBL::Hive::RunnableDB::SqlCmd --db_conn mysql://ensadmin:${ENSADMIN_PSW}@127.0.0.1:2913/lg4_compara_homology_merged_64 \
--sql "[ 'CREATE TABLE meta_foo LIKE meta', 'INSERT INTO meta_foo SELECT * FROM meta' ]"

Description

    This RunnableDB module acts as a wrapper for an SQL command
    run against either the current hive database (default) or against one specified by 'db_conn' parameter
    (--db_conn becomes obligatory in standalone mode, because there is no hive_db).
    If you behave you may also use parameter substitution.

    The SQL command(s) can be given using two different syntaxes:

    1) Sql command is stored in the input_id() or parameters() as the value corresponding to the 'sql' key.
        THIS IS THE RECOMMENDED WAY as it allows to pass in other parameters and use the parameter substitution mechanism in its full glory.

    2) Sql command is stored in the 'input_id' field of the job table.
        (only works with sql commands shorter than 255 bytes).
        This is a legacy syntax. Most people tend to use it not realizing there are other possiblities.

Member Function Documentation

public Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::fetch_input ( )
    Description : Implements fetch_input() interface method of Bio::EnsEMBL::Hive::Process that is used to read in parameters and load data.
                  Here it deals with finding the sql command(s), doing parameter substitution, storing the result in a predefined place
                  and optionally connecting to another database (see param('db_conn')).
    param('sql'): The recommended way of passing in the sql command(s).
    param('db_conn'): An optional hash to pass in connection parameters to the database upon which the sql command(s) will have to be run.
    param('*'):   Any other parameters can be freely used for parameter substitution.
 
Code:
click to view
public Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::run ( )
    Description : Implements run() interface method of Bio::EnsEMBL::Hive::Process that is used to perform the main bulk of the job (minus input and output).
                  Here it actually runs the sql command(s).  If a list of commands is given, they are run in succession within the same session
                  (so you can create a temporary tables and use it in another command within the same sql command list).
 
Code:
click to view
public Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::strict_hash_format ( )
    Description : Implements strict_hash_format() interface method of Bio::EnsEMBL::Hive::Process that is used to set the strictness level of the parameters' parser.
                  Here we return 0 in order to indicate that neither input_id() nor parameters() is required to contain a hash.
 
Code:
click to view
public Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::write_output ( )
    Description : Implements write_output() interface method of Bio::EnsEMBL::Hive::Process that is used to deal with job's output after the execution.
                  Here we only flow out the insert_ids.
 
Code:
click to view

The documentation for this class was generated from the following file: