Class: Upkeep::SQLGlot::LineageNode

Inherits:
Data
  • Object
show all
Defined in:
lib/upkeep/sqlglot.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliasObject (readonly)

Returns the value of attribute alias

Returns:

  • (Object)

    the current value of alias



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def alias
  @alias
end

#depthObject (readonly)

Returns the value of attribute depth

Returns:

  • (Object)

    the current value of depth



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def depth
  @depth
end

#downstreamObject (readonly)

Returns the value of attribute downstream

Returns:

  • (Object)

    the current value of downstream



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def downstream
  @downstream
end

#expressionObject (readonly)

Returns the value of attribute expression

Returns:

  • (Object)

    the current value of expression



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def expression
  @expression
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def name
  @name
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def source
  @source
end

#source_nameObject (readonly)

Returns the value of attribute source_name

Returns:

  • (Object)

    the current value of source_name



183
184
185
# File 'lib/upkeep/sqlglot.rb', line 183

def source_name
  @source_name
end

Class Method Details

.from_native(value) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/upkeep/sqlglot.rb', line 192

def self.from_native(value)
  new(
    name: value.fetch("name"),
    expression: value["expression"],
    source_name: value["source_name"],
    source: value["source"],
    downstream: value.fetch("downstream").map { |child| from_native(child) }
      .freeze,
    alias: value["alias"],
    depth: value.fetch("depth")
  )
end

Instance Method Details

#source_tablesObject



212
213
214
# File 'lib/upkeep/sqlglot.rb', line 212

def source_tables
  walk.filter_map(&:source_name).uniq.sort
end

#walk {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



205
206
207
208
209
210
# File 'lib/upkeep/sqlglot.rb', line 205

def walk(&block)
  return enum_for(:walk) unless block

  yield self
  downstream.each { |child| child.walk(&block) }
end