Example #1
0
    def test_add_partition_string_key(self):
        part_schema = ibis.schema([('foo', 'int32'), ('bar', 'string')])
        stmt = ddl.AddPartition('tbl', {'foo': 5, 'bar': 'qux'}, part_schema)

        result = stmt.compile()
        expected = 'ALTER TABLE tbl ADD PARTITION (foo=5, bar="qux")'
        assert result == expected
Example #2
0
    def test_add_partition(self):
        stmt = ddl.AddPartition(self.table_name,
                                {'year': 2007, 'month': 4},
                                self.part_schema)

        result = stmt.compile()
        expected = 'ALTER TABLE tbl ADD PARTITION (year=2007, month=4)'
        assert result == expected
def test_add_partition_with_props(part_schema, table_name):
    props = dict(location='/users/foo/my-data')
    stmt = ddl.AddPartition(
        table_name, {'year': 2007, 'month': 4}, part_schema, **props
    )

    result = stmt.compile()
    expected = """\
ALTER TABLE tbl ADD PARTITION (year=2007, month=4)
LOCATION '/users/foo/my-data'"""
    assert result == expected