Class: Flydata::Command::Psql
- Defined in:
- lib/flydata/source_postgresql/command/psql.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
Instance Attribute Summary
Attributes inherited from Sync
#ddl_tables, #full_initial_sync, #full_tables, #input_tables, #new_tables
Attributes inherited from Base
Instance Method Summary collapse
- #flush ⇒ Object
- #generate_command(dbconf, args) ⇒ Object
- #generate_table_ddl ⇒ Object
- #reset ⇒ Object
- #run(*args) ⇒ Object
- #skip ⇒ Object
Methods inherited from Sync
#_reset, #check, #clear, #compat_check, #repair, #resync, 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
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
#flush ⇒ Object
41 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 41 def flush; end |
#generate_command(dbconf, args) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 32 def generate_command(dbconf, args) password = Shellwords.escape(dbconf['password']) database = Shellwords.escape(dbconf['database']) host = Shellwords.escape(dbconf['host']) port = Shellwords.escape(dbconf['port']) username = Shellwords.escape(dbconf['username']) "PGCONNECT_TIMEOUT=5 PGPASSWORD=#{password} psql -d #{database} -h #{host} -p #{port} -U #{username}" end |
#generate_table_ddl ⇒ Object
44 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 44 def generate_table_ddl; end |
#reset ⇒ Object
42 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 42 def reset; end |
#run(*args) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 10 def run(*args) de = data_entry cmd = generate_command(de['postgresql_data_entry_preference'], args) return if cmd.to_s.empty? $stderr.puts "command:#{cmd}" if FLYDATA_DEBUG if $stdin.tty? # interactive shell system cmd else # execute queries given to $stdin Open3.popen2e(cmd) do |i, o, wt| $stdin.each_line do |line| i.print line end i.close while line = o.gets print line end end end end |
#skip ⇒ Object
43 |
# File 'lib/flydata/source_postgresql/command/psql.rb', line 43 def skip; end |