Class: Upkeep::SQLGlot::MappingSchema

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapping = {}, dialect: nil) ⇒ MappingSchema

Returns a new instance of MappingSchema.



238
239
240
241
242
243
# File 'lib/upkeep/sqlglot.rb', line 238

def initialize(mapping = {}, dialect: nil)
  @dialect = Dialect.resolve(dialect) || "ansi"
  @mapping = deep_freeze(stringify_mapping(mapping.to_h))
  @tables = flatten_tables(@mapping).freeze
  freeze
end

Instance Attribute Details

#dialectObject (readonly)

Returns the value of attribute dialect.



236
237
238
# File 'lib/upkeep/sqlglot.rb', line 236

def dialect
  @dialect
end

Instance Method Details

#to_dependency_nativeObject



249
250
251
# File 'lib/upkeep/sqlglot.rb', line 249

def to_dependency_native
  {tables: native_tables { "UNKNOWN" }}
end

#to_nativeObject



245
246
247
# File 'lib/upkeep/sqlglot.rb', line 245

def to_native
  {tables: native_tables { |_name, data_type| data_type }}
end