Class: DeltaLake::TableAlterer

Inherits:
Object
  • Object
show all
Defined in:
lib/deltalake/table_alterer.rb

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ TableAlterer

Returns a new instance of TableAlterer.



3
4
5
# File 'lib/deltalake/table_alterer.rb', line 3

def initialize(table)
  @table = table
end

Instance Method Details

#add_constraint(constraints) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/deltalake/table_alterer.rb', line 7

def add_constraint(constraints)
  if constraints.length > 1
    raise ArgumentError,
      "add_constraints is limited to a single constraint addition at once for now."
  end

  @table._table.add_constraints(
    constraints
  )
end

#drop_constraint(name, raise_if_not_exists: true) ⇒ Object



18
19
20
21
22
23
# File 'lib/deltalake/table_alterer.rb', line 18

def drop_constraint(name, raise_if_not_exists: true)
  @table._table.drop_constraints(
    name,
    raise_if_not_exists
  )
end