MCPcopy Create free account
hub / github.com/TileDB-Inc/TileDB / ArraySchemaEvolution

Class ArraySchemaEvolution

tiledb/sm/cpp_api/array_schema_evolution.h:69–297  ·  view source on GitHub ↗

* Evolve the schema on a tiledb::Array. * * @details * See examples for more usage details. * * **Example:** * * @code{.cpp} * // Open the array for writing * tiledb::Context ctx; * tiledb::ArraySchemaEvolution evolution(ctx); * evolution.drop_attribute("a1"); * evolution.array_evolve("my_test_array"); * @endcode */

Source from the content-addressed store, hash-verified

67 * @endcode
68 */
69class ArraySchemaEvolution {
70 public:
71 /* ********************************* */
72 /* CONSTRUCTORS & DESTRUCTORS */
73 /* ********************************* */
74
75 /**
76 * Constructs the array schema evolution with the input C array
77 * array schema evolution object.
78 *
79 * @param ctx TileDB context
80 * @param evolution C API array schema evolution object
81 */
82 ArraySchemaEvolution(
83 const Context& context, tiledb_array_schema_evolution_t* evolution)
84 : ctx_(context) {
85 evolution_ =
86 std::shared_ptr<tiledb_array_schema_evolution_t>(evolution, deleter_);
87 }
88
89 /**
90 * Constructs an array schema evolution object.
91 *
92 * @param ctx TileDB context
93 */
94 ArraySchemaEvolution(const Context& context)
95 : ctx_(context) {
96 tiledb_array_schema_evolution_t* evolution;
97 auto& ctx = ctx_.get();
98 ctx.handle_error(
99 tiledb_array_schema_evolution_alloc(ctx.ptr().get(), &evolution));
100 evolution_ =
101 std::shared_ptr<tiledb_array_schema_evolution_t>(evolution, deleter_);
102 }
103
104 ArraySchemaEvolution(const ArraySchemaEvolution&) = default;
105 ArraySchemaEvolution(ArraySchemaEvolution&&) = default;
106 ArraySchemaEvolution& operator=(const ArraySchemaEvolution&) = default;
107 ArraySchemaEvolution& operator=(ArraySchemaEvolution&&) = default;
108 virtual ~ArraySchemaEvolution() = default;
109
110 /* ********************************* */
111 /* API */
112 /* ********************************* */
113
114 /**
115 * Adds an Attribute to the array schema evolution.
116 *
117 * **Example:**
118 * @code{.cpp}
119 * tiledb::Context ctx;
120 * tiledb::ArraySchemaEvolution schema_evolution(ctx);
121 * schema_evolution.add_attribute(Attribute::create<int32_t>(ctx,
122 * "attr_name"));
123 * @endcode
124 *
125 * @param attr The Attribute to add
126 * @return Reference to this `ArraySchemaEvolution` instance.

Callers

nothing calls this directly

Tested by

no test coverage detected