# File lib/table_saw/dependency_graph/dump_table.rb, line 41 def primary_key TableSaw.schema_cache.primary_keys(name) end
class TableSaw::DependencyGraph::DumpTable
Attributes
ids[R]
manifest[R]
name[R]
partial[R]
Public Class Methods
new(manifest:, name:, partial: true)
click to toggle source
# File lib/table_saw/dependency_graph/dump_table.rb, line 8 def initialize(manifest:, name:, partial: true) @manifest = manifest @name = name @partial = partial @ids = Set.new end
Public Instance Methods
copy_statement()
click to toggle source
# File lib/table_saw/dependency_graph/dump_table.rb, line 15 def copy_statement if partial format 'select * from %{name} where %{clause}', name: name, clause: TableSaw::Queries::SerializeSqlInClause.new(name, primary_key, ids.to_a).call else "select * from #{name}" end end
fetch_associations(directive)
click to toggle source
# File lib/table_saw/dependency_graph/dump_table.rb, line 25 def fetch_associations(directive) directive.ids = directive.ids - ids.to_a ids.merge(directive.ids) fetch_belongs_to(directive) + fetch_has_many(directive) end
Private Instance Methods
fetch_belongs_to(directive)
click to toggle source
# File lib/table_saw/dependency_graph/dump_table.rb, line 33 def fetch_belongs_to(directive) TableSaw::DependencyGraph::BelongsToDirectives.new(manifest, directive).call end
fetch_has_many(directive)
click to toggle source
# File lib/table_saw/dependency_graph/dump_table.rb, line 37 def fetch_has_many(directive) TableSaw::DependencyGraph::HasManyDirectives.new(manifest, directive).call end
primary_key()
click to toggle source