MCPcopy Create free account
hub / github.com/alibaba/zvec / bind_ddl_methods

Method bind_ddl_methods

src/binding/python/model/python_collection.cc:97–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95
96
97void ZVecPyCollection::bind_ddl_methods(
98 py::class_<Collection, Collection::Ptr> &col) {
99 // bind collection properties
100 col.def("Path",
101 [](const Collection &self) {
102 auto ret = self.Path();
103 return unwrap_expected(ret);
104 })
105 .def("Options",
106 [](const Collection &self) {
107 auto ret = self.Options();
108 return unwrap_expected(ret);
109 })
110 .def("Schema",
111 [](const Collection &self) {
112 auto ret = self.Schema();
113 return unwrap_expected(ret);
114 })
115 .def("Stats", [](const Collection &self) {
116 auto ret = self.Stats();
117 return unwrap_expected(ret);
118 });
119
120 // bind collection ddl methods
121 col.def("Destroy",
122 [](Collection &self) {
123 Status status;
124 {
125 py::gil_scoped_release release;
126 status = self.Destroy();
127 }
128 throw_if_error(status);
129 })
130 .def("Flush", [](Collection &self) {
131 Status status;
132 {
133 py::gil_scoped_release release;
134 status = self.Flush();
135 }
136 throw_if_error(status);
137 });
138
139 // binding index ddl methods
140 col.def("CreateIndex",
141 [](Collection &self, const std::string &column_name,
142 const IndexParams::Ptr &index_options,
143 const CreateIndexOptions &options) {
144 Status status;
145 {
146 py::gil_scoped_release release;
147 status = self.CreateIndex(column_name, index_options, options);
148 }
149 throw_if_error(status);
150 })
151 .def("DropIndex",
152 [](Collection &self, const std::string &column_name) {
153 Status status;
154 {

Callers

nothing calls this directly

Calls 14

unwrap_expectedFunction · 0.85
throw_if_errorFunction · 0.85
PathMethod · 0.80
SchemaMethod · 0.80
CreateIndexMethod · 0.80
DropIndexMethod · 0.80
OptimizeMethod · 0.80
AddColumnMethod · 0.80
DropColumnMethod · 0.80
AlterColumnMethod · 0.80
OptionsMethod · 0.45
StatsMethod · 0.45

Tested by

no test coverage detected