ensembl-hive  2.5
Bio::EnsEMBL::Hive::RunnableDB::SqlCmd Class Reference
+ Inheritance diagram for Bio::EnsEMBL::Hive::RunnableDB::SqlCmd:

Public Member Functions

public param_defaults ()
 
public run ()
 
protected _exec_sql ()
 
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 param_defaults ()
 
public fetch_input ()
 
public run ()
 
public write_output ()
 
public Bio::EnsEMBL::Hive::Worker worker ()
 
public 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 Returns run_system_command ()
 
public Bio::EnsEMBL::Hive::AnalysisJob input_job ()
 
public input_id ()
 
public param ()
 
public param_required ()
 
public param_exists ()
 
public param_is_defined ()
 
public param_substitute ()
 
public dataflow_output_id ()
 
public dataflow_output_ids_from_json ()
 
public throw ()
 
public This 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).

    The Sql command must be stored in the parameters() as the value corresponding to the 'sql' key.
    It allows to pass in other parameters and use the parameter substitution mechanism in its full glory.

    The Sql command(s) can be wrapped in a global transaction if the "wrap_in_transaction" flag is switched on (off by default)

Definition at line 27 of file SqlCmd.pm.

Member Function Documentation

◆ _exec_sql()

protected Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::_exec_sql ( )
    Description : Actually run 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).
    param('sql'): Either a scalar SQL command or an array of SQL commands.
    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

◆ param_defaults()

public Bio::EnsEMBL::Hive::RunnableDB::SqlCmd::param_defaults ( )

Undocumented method

Code:
click to view

◆ run()

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 is a simple decision step based on the "wrap_in_transaction" parameter. If the latter is set, call _exec_sql() in a transaction,
                  otherwise call it directly.
    param('wrap_in_transaction'): Whether or not run the commands in a global transaction
 
Code:
click to view

◆ write_output()

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: