Class: Flydata::Source::SyncGenerateTableDdl
- Defined in:
- lib/flydata/source/sync_generate_table_ddl.rb
Direct Known Subclasses
Flydata::SourceMysql::SyncGenerateTableDdl, Flydata::SourcePostgresql::SyncGenerateTableDdl, Flydata::SourceZendesk::SyncGenerateTableDdl
Instance Attribute Summary collapse
-
#dp ⇒ Object
readonly
Returns the value of attribute dp.
Class Method Summary collapse
Instance Method Summary collapse
- #generate_flydata_tabledef(tables, options) ⇒ Object
-
#initialize(source, dp, options) ⇒ SyncGenerateTableDdl
constructor
A new instance of SyncGenerateTableDdl.
-
#run_compatibility_check ⇒ Object
Public Interface: Run compatibility check.
Constructor Details
#initialize(source, dp, options) ⇒ SyncGenerateTableDdl
Returns a new instance of SyncGenerateTableDdl.
13 14 15 16 |
# File 'lib/flydata/source/sync_generate_table_ddl.rb', line 13 def initialize(source, dp, ) super(source, ) @dp = dp end |
Instance Attribute Details
#dp ⇒ Object (readonly)
Returns the value of attribute dp.
17 18 19 |
# File 'lib/flydata/source/sync_generate_table_ddl.rb', line 17 def dp @dp end |
Class Method Details
Instance Method Details
#generate_flydata_tabledef(tables, options) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/flydata/source/sync_generate_table_ddl.rb', line 29 def generate_flydata_tabledef(tables, ) prefs = data_entry_prefs = .merge(prefs) flydata_tabledefs = [] error_list = [] missing_tables = each_source_tabledef(tables, ) do |source_tabledef, error| if error error_list << error.err_hash next end flydata_tabledefs << source_tabledef.to_flydata_tabledef end if missing_tables missing_tables.each {|missing_table| error_list << { error: "table does not exist in the #{data_source_type_display_name}", table: missing_table } } end [flydata_tabledefs, error_list] end |
#run_compatibility_check ⇒ Object
Public Interface: Run compatibility check
Run whatever check (compatibility, connectivity, privilege, etc) to ensure that the ‘sync:generate_table_ddl’ command can run without an issue.
Raises exception when check fails
25 26 27 |
# File 'lib/flydata/source/sync_generate_table_ddl.rb', line 25 def run_compatibility_check raise UnsupportedSourceError, "subclass must implement" end |