| #include <tiledb/tiledb> |
| #include <tiledb/tiledb_experimental> |
|
|
| #include "common.h" |
|
|
| #include <pybind11/numpy.h> |
| #include <pybind11/pybind11.h> |
| #include <pybind11/pytypes.h> |
| #include <pybind11/stl.h> |
|
|
| |
| |
|
|
| namespace libtiledbcpp { |
|
|
| using namespace tiledb; |
| using namespace std; |
| namespace py = pybind11; |
|
|
| void init_query(py::module &m) { |
| py::class_<tiledb::Query>(m, "Query") |
|
|
| |
| |
|
|
| .def(py::init<Context &, Array &, tiledb_query_type_t>(), |
| py::keep_alive<1, 2>() , |
| py::keep_alive<1, 3>() ) |
|
|
| .def(py::init<Context &, Array &>(), |
| py::keep_alive<1, 2>() , |
| py::keep_alive<1, 3>() ) |
|
|
| |
|
|
| .def_property("layout", &Query::query_layout, &Query::set_layout) |
|
|
| .def_property_readonly("query_type", &Query::query_type) |
|
|
| .def_property_readonly("_subarray", |
| [](Query &query) { |
| |
| |
| |
| Subarray subarray(query.ctx(), query.array()); |
| query.update_subarray_from_query(&subarray); |
| return subarray; |
| }) |
|
|
| |
|
|
| .def("has_results", &Query::has_results) |
|
|
| .def("is_complete", |
| [](const Query &query) { |
| return query.query_status() == Query::Status::COMPLETE; |
| }) |
|
|
| .def("finalize", &Query::finalize) |
|
|
| .def("fragment_num", &Query::fragment_num) |
|
|
| .def("fragment_uri", &Query::fragment_uri) |
|
|
| .def("query_status", &Query::query_status) |
|
|
| .def("set_condition", &Query::set_condition) |
|
|
| |
| |
| |
|
|
| .def("set_data_buffer", |
| [](Query &q, std::string name, py::array a) { |
| |
| |
| q.set_data_buffer(name, const_cast<void *>(a.data()), a.size()); |
| }) |
|
|
| .def("set_offsets_buffer", |
| [](Query &q, std::string name, py::array a) { |
| |
| |
| q.set_offsets_buffer(name, (uint64_t *)(a.data()), a.size()); |
| }) |
|
|
| .def("set_subarray", |
| [](Query &query, const Subarray &subarray) { |
| return query.set_subarray(subarray); |
| }) |
|
|
| .def("set_validity_buffer", |
| [](Query &q, std::string name, py::array a) { |
| |
| |
| q.set_validity_buffer(name, (uint8_t *)(a.data()), a.size()); |
| }) |
|
|
| .def("submit", &Query::submit, py::call_guard<py::gil_scoped_release>()) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| ; |
| } |
|
|
| } |
|
|