Class: Flydata::Command::Mysqldump

Inherits:
Sync
  • Object
show all
Includes:
MysqlCommandBase
Defined in:
lib/flydata/source_mysql/command/mysqldump.rb

Constant Summary

Constants inherited from Sync

Sync::AUTO_CREATE_STATUS_CREATED_TABLES, Sync::AUTO_CREATE_STATUS_START, Sync::INSERT_PROGRESS_INTERVAL, Sync::RUN_PROFILE, Sync::SERVER_DATA_PROCESSING_TIMEOUT, Sync::STATUS_COMPLETE, Sync::STATUS_PARSED, Sync::STATUS_PARSING, Sync::STATUS_START

Constants included from Helpers

Helpers::UNIT_PREFIX

Instance Attribute Summary

Attributes inherited from Sync

#ddl_tables, #full_initial_sync, #full_tables, #input_tables, #new_tables

Attributes inherited from Base

#opts

Instance Method Summary collapse

Methods included from MysqlCommandBase

#flush, #generate_table_ddl, #reset, #run, #skip

Methods inherited from Sync

#_reset, #check, #clear, #compat_check, #flush, #generate_table_ddl, #repair, #reset, #resync, #run, #skip, slop, slop_clear, slop_flush, slop_generate_table_ddl, slop_repair, slop_reset, slop_resync, #try_initial_sync

Methods included from Helpers

as_size, development?, env_mode, env_suffix, flydata_api_host_file, flydata_conf_file, flydata_version, format_menu_list, retry_on, to_command_class, usage_text

Methods inherited from Base

#ask_input_table_name, #ask_yes_no, #choose_one, #dashboard_url, #data_entry, #data_port, #flydata, #initialize, #newline, #redshift_cluster, #redshift_console_url, #register_crontab, #retrieve_data_entries, #separator, #show_purpose_name, #source

Methods included from ExclusiveRunnable

included

Methods included from Flydata::CommandLoggable

#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr

Constructor Details

This class inherits a constructor from Flydata::Command::Base

Instance Method Details

#build_custom_option_end(args) ⇒ Object

Workaround to build –where options correctly

Background

Arguments including single/double quotations don’t work because those quotations are removed from the system.

User’s command:

flydata mysqldump table_a --where "id = 1001"

ARGV:

["table_a", "--where", "id", "=", "1001"]


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/flydata/source_mysql/command/mysqldump.rb', line 28

def build_custom_option_end(args)
  ret = []
  while v = args.shift
    ret << v
    if v == '--where'
      ret << %Q|"#{args.join(' ')}"|
      break
    end
  end
  ret.join(' ')
end

#generate_command(dbconf, args) ⇒ Object



10
11
12
13
14
15
# File 'lib/flydata/source_mysql/command/mysqldump.rb', line 10

def generate_command(dbconf, args)
  dbconf.delete('tables')
  dbconf[:custom_option_end] = build_custom_option_end(args)
  dbconf[:command] = 'mysqldump'
  FlydataCore::Mysql::CommandGenerator::generate_mysql_cmd(dbconf)
end