Links

Evolving the Array Schema

Modifying Array Schema After Creation

Schema evolution allows you to change the schema of an array after it has been created.
C
C++
Python
R
Java
Go
// TODO
// TODO
import tiledb
import numpy as np
# You must pass a context to the `ArraySchemaEvolution` object
ctx = tiledb.default_ctx()
se = tiledb.ArraySchemaEvolution(ctx)
# To append a new attribute, create an `Attr` object and pass to `add_attribute`
se.add_attribute(tiledb.Attr("attr1", dtype=np.int8))
# To remove an attribute, pass the attribute name to `drop_attribute`
se.drop_attribute("attr2")
# Apply the schema evolution changes to the already existing array
se.array_evolve(array_uri)
# create an array at 'uri' from 'df'
fromDataFrame(df, uri)
# create a schema evolution object and add an integer column 'foo'
ase <- tiledb_array_schema_evolution()
attr <- tiledb_attr("foo", "INT32")
ase <- tiledb_array_schema_evolution_add_attribute(ase, attr)
ase <- tiledb_array_schema_evolution_array_evolve(ase, uri)
# now 'newarr' will show the expanded array
newarr <- tiledb_array(uri, return_as="data.frame", extended=FALSE)
Array array = new Array(ctx, "<array-uri>");
// You must pass a context to the `ArraySchemaEvolution` object
ArraySchemaEvolution schemaEvolution = new ArraySchemaEvolution(ctx);
// Create a new attribute to append to the existing schema
Attribute a3 = new Attribute(ctx, "a3", Float.class);
// Pass the attribute to `addAttribute`
schemaEvolution.addAttribute(a3);
// Drop attribute
schemaEvolution.dropAttribute("a2");
schemaEvolution.evolveArray("<array-uri>");
// OR
// array.evolve(ctx, schemaEvolution);
// Apply the schema evolution changes to the already existing array
array.close();
// TODO