Class: Flydata::Source::SyncGenerateTableDdl
- Defined in:
- lib/flydata/source/sync_generate_table_ddl.rb
Direct Known Subclasses
Flydata::SourceMysql::SyncGenerateTableDdl, Flydata::SourceOracle::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 47 48 49 50 51 52 53 54 55 |
# File 'lib/flydata/source/sync_generate_table_ddl.rb', line 29 def generate_flydata_tabledef(tables, ) prefs = data_entry_prefs reset_uk_as_pk_override(tables, prefs) = .merge(prefs) flydata_tabledefs = [] error_list = [] uk_as_pk_override = {} missing_tables = each_source_tabledef(tables, ) do |source_tabledef, error| if error error_list << error.err_hash next end if source_tabledef.converting_uk_to_pk? new_pk_override = source_tabledef.get_pk_override_as_hash uk_as_pk_override.merge!(new_pk_override) 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, uk_as_pk_override] 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 |