quasardb 3.14.2.dev1__cp311-cp311-macosx_11_0_arm64.whl → 3.14.2.dev4__cp311-cp311-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of quasardb might be problematic. Click here for more details.

Files changed (95) hide show
  1. quasardb/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  2. quasardb/Makefile +20 -20
  3. quasardb/__init__.py +33 -4
  4. quasardb/cmake_install.cmake +7 -1
  5. quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  6. quasardb/date/CMakeFiles/Export/a52b05f964b070ee926bcad51d3288af/dateTargets.cmake +13 -13
  7. quasardb/date/Makefile +20 -20
  8. quasardb/date/cmake_install.cmake +7 -1
  9. quasardb/date/dateConfigVersion.cmake +9 -2
  10. quasardb/date/dateTargets.cmake +4 -8
  11. quasardb/libqdb_api.dylib +0 -0
  12. quasardb/numpy/__init__.py +58 -10
  13. quasardb/pandas/__init__.py +58 -102
  14. quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  15. quasardb/pybind11/Makefile +20 -20
  16. quasardb/pybind11/cmake_install.cmake +7 -1
  17. quasardb/quasardb.cpython-311-darwin.so +0 -0
  18. quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
  19. quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +13 -13
  20. quasardb/range-v3/CMakeFiles/range.v3.headers.dir/DependInfo.cmake +6 -2
  21. quasardb/range-v3/CMakeFiles/range.v3.headers.dir/build.make +7 -4
  22. quasardb/range-v3/Makefile +20 -20
  23. quasardb/range-v3/cmake_install.cmake +19 -1
  24. quasardb/range-v3/range-v3-config-version.cmake +9 -2
  25. quasardb/range-v3/range-v3-config.cmake +4 -8
  26. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/METADATA +15 -10
  27. quasardb-3.14.2.dev4.dist-info/RECORD +45 -0
  28. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/WHEEL +1 -1
  29. quasardb/CMakeLists.txt +0 -510
  30. quasardb/batch_column.hpp +0 -80
  31. quasardb/batch_inserter.hpp +0 -248
  32. quasardb/blob.hpp +0 -150
  33. quasardb/cluster.cpp +0 -89
  34. quasardb/cluster.hpp +0 -551
  35. quasardb/concepts.hpp +0 -278
  36. quasardb/continuous.cpp +0 -149
  37. quasardb/continuous.hpp +0 -106
  38. quasardb/convert/array.hpp +0 -282
  39. quasardb/convert/point.hpp +0 -330
  40. quasardb/convert/range.hpp +0 -282
  41. quasardb/convert/unicode.hpp +0 -598
  42. quasardb/convert/util.hpp +0 -22
  43. quasardb/convert/value.hpp +0 -711
  44. quasardb/convert.hpp +0 -38
  45. quasardb/detail/qdb_resource.hpp +0 -129
  46. quasardb/detail/ts_column.hpp +0 -224
  47. quasardb/direct_blob.hpp +0 -108
  48. quasardb/direct_handle.hpp +0 -83
  49. quasardb/direct_integer.hpp +0 -94
  50. quasardb/dispatch.hpp +0 -157
  51. quasardb/double.hpp +0 -87
  52. quasardb/entry.hpp +0 -273
  53. quasardb/error.hpp +0 -318
  54. quasardb/handle.cpp +0 -29
  55. quasardb/handle.hpp +0 -98
  56. quasardb/integer.hpp +0 -88
  57. quasardb/logger.cpp +0 -106
  58. quasardb/logger.hpp +0 -228
  59. quasardb/masked_array.hpp +0 -651
  60. quasardb/metrics.cpp +0 -103
  61. quasardb/metrics.hpp +0 -112
  62. quasardb/module.cpp +0 -76
  63. quasardb/module.hpp +0 -24
  64. quasardb/node.hpp +0 -123
  65. quasardb/numpy.cpp +0 -6
  66. quasardb/numpy.hpp +0 -489
  67. quasardb/object_tracker.hpp +0 -283
  68. quasardb/options.hpp +0 -244
  69. quasardb/perf.hpp +0 -336
  70. quasardb/pytypes.hpp +0 -221
  71. quasardb/query.cpp +0 -420
  72. quasardb/query.hpp +0 -92
  73. quasardb/reader/ts_row.hpp +0 -281
  74. quasardb/reader/ts_value.hpp +0 -245
  75. quasardb/remove_cvref.hpp +0 -31
  76. quasardb/string.hpp +0 -160
  77. quasardb/table.cpp +0 -289
  78. quasardb/table.hpp +0 -325
  79. quasardb/table_reader.hpp +0 -220
  80. quasardb/tag.hpp +0 -77
  81. quasardb/timestamp.hpp +0 -97
  82. quasardb/traits.hpp +0 -619
  83. quasardb/ts_iterator.hpp +0 -193
  84. quasardb/utils/blob_deque.hpp +0 -96
  85. quasardb/utils/ostream.hpp +0 -17
  86. quasardb/utils/permutation.hpp +0 -50
  87. quasardb/utils/stable_sort.hpp +0 -25
  88. quasardb/utils/unzip_view.hpp +0 -89
  89. quasardb/utils.cpp +0 -28
  90. quasardb/utils.hpp +0 -174
  91. quasardb/writer.cpp +0 -534
  92. quasardb/writer.hpp +0 -396
  93. quasardb-3.14.2.dev1.dist-info/RECORD +0 -109
  94. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/LICENSE.md +0 -0
  95. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev4.dist-info}/top_level.txt +0 -0
quasardb/table.hpp DELETED
@@ -1,325 +0,0 @@
1
- /*
2
- *
3
- * Official Python API
4
- *
5
- * Copyright (c) 2009-2024, quasardb SAS. All rights reserved.
6
- * All rights reserved.
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions are met:
10
- *
11
- * * Redistributions of source code must retain the above copyright
12
- * notice, this list of conditions and the following disclaimer.
13
- * * Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- * * Neither the name of quasardb nor the names of its contributors may
17
- * be used to endorse or promote products derived from this software
18
- * without specific prior written permission.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
21
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
24
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- */
31
- #pragma once
32
-
33
- #include "entry.hpp"
34
- #include "masked_array.hpp"
35
- #include "detail/ts_column.hpp"
36
-
37
- namespace qdb
38
- {
39
-
40
- class table : public entry
41
- {
42
- public:
43
- table(handle_ptr h, std::string a)
44
- : entry{h, a}
45
- , _has_indexed_columns(false)
46
- {
47
- _cache_metadata();
48
- }
49
-
50
- public:
51
- std::string repr() const
52
- {
53
- return "<quasardb.Table name='" + get_name() + "'>";
54
- }
55
-
56
- /**
57
- * Retrieves (and caches) table metadata. This mainly involves column information.
58
- */
59
- void retrieve_metadata()
60
- {
61
- _cache_metadata();
62
- }
63
-
64
- void create(const std::vector<detail::column_info> & columns,
65
- std::chrono::milliseconds shard_size = std::chrono::hours{24},
66
- std::chrono::milliseconds ttl = std::chrono::milliseconds::zero())
67
- {
68
- _handle->check_open();
69
-
70
- qdb_duration_t ttl_ = qdb_ttl_disabled;
71
- if (ttl != std::chrono::milliseconds::zero())
72
- {
73
- ttl_ = ttl.count();
74
- }
75
-
76
- const auto c_columns = detail::convert_columns_ex(columns);
77
- qdb::qdb_throw_if_error(*_handle, qdb_ts_create_ex(*_handle, _alias.c_str(), shard_size.count(),
78
- c_columns.data(), c_columns.size(), ttl_));
79
- }
80
-
81
- void insert_columns(const std::vector<detail::column_info> & columns)
82
- {
83
- _handle->check_open();
84
-
85
- const auto c_columns = detail::convert_columns_ex(columns);
86
- qdb::qdb_throw_if_error(*_handle,
87
- qdb_ts_insert_columns_ex(*_handle, _alias.c_str(), c_columns.data(), c_columns.size()));
88
- }
89
-
90
- std::vector<detail::column_info> list_columns() const
91
- {
92
- if (_columns.has_value()) [[likely]]
93
- {
94
- return _columns.value();
95
- }
96
-
97
- _cache_metadata();
98
-
99
- if (_columns.has_value()) [[likely]]
100
- {
101
- return _columns.value();
102
- }
103
-
104
- throw qdb::alias_not_found_exception{};
105
- }
106
-
107
- detail::indexed_column_info column_info_by_id(const std::string & alias) const
108
- {
109
- if (_has_indexed_columns == false)
110
- {
111
- // It's important to note that if additional columns are added during
112
- // the lifetime of this object, we will not pick up on this in our cache.
113
- _indexed_columns = detail::index_columns(list_columns());
114
- _has_indexed_columns = true;
115
- }
116
-
117
- detail::indexed_columns_t::const_iterator i = _indexed_columns.find(alias);
118
- if (i == _indexed_columns.end())
119
- throw qdb::exception{qdb_e_out_of_bounds, std::string("Column not found: ") + alias};
120
-
121
- return i->second;
122
- }
123
-
124
- detail::column_info column_info_by_index(qdb_size_t idx) const
125
- {
126
- auto cols = list_columns();
127
-
128
- // Not strictly necessary, but avoids an "ugly" exception being thrown when
129
- // using .at() below.
130
- if (cols.size() <= idx) [[unlikely]]
131
- {
132
- throw qdb::exception{
133
- qdb_e_out_of_bounds, std::string("Column index out of bounds: ") + std::to_string(idx)};
134
- }
135
-
136
- return cols.at(idx);
137
- }
138
-
139
- std::string column_id_by_index(qdb_size_t idx) const
140
- {
141
- return column_info_by_index(idx).name;
142
- }
143
-
144
- qdb_ts_column_type_t column_type_by_index(qdb_size_t idx) const
145
- {
146
- return column_info_by_index(idx).type;
147
- }
148
-
149
- qdb_size_t column_index_by_id(const std::string & alias) const
150
- {
151
- return column_info_by_id(alias).index;
152
- }
153
-
154
- qdb_ts_column_type_t column_type_by_id(const std::string & alias) const
155
- {
156
- return column_info_by_id(alias).type;
157
- }
158
-
159
- py::object reader(
160
- const std::vector<std::string> & columns, py::object obj_ranges, bool dict_mode) const;
161
-
162
- /**
163
- * Returns true if this table has a TTL assigned.
164
- */
165
- inline bool has_ttl() const
166
- {
167
- if (_ttl.has_value()) [[likely]]
168
- {
169
- return _ttl.value() != std::chrono::milliseconds::zero();
170
- }
171
-
172
- _cache_metadata();
173
-
174
- if (_ttl.has_value()) [[likely]]
175
- {
176
- return _ttl.value() != std::chrono::milliseconds::zero();
177
- }
178
-
179
- throw qdb::alias_not_found_exception{};
180
- }
181
-
182
- inline std::chrono::milliseconds get_ttl() const
183
- {
184
- if (_ttl.has_value()) [[likely]]
185
- {
186
- return _ttl.value();
187
- }
188
-
189
- _cache_metadata();
190
-
191
- if (_ttl.has_value()) [[likely]]
192
- {
193
- return _ttl.value();
194
- }
195
-
196
- throw qdb::alias_not_found_exception{};
197
- }
198
-
199
- private:
200
- /**
201
- * Loads column info / metadata from server and caches it locally.
202
- */
203
- void _cache_metadata() const;
204
-
205
- /**
206
- * Loads column info / metadata from server if not yet cached locally.
207
- */
208
- void _maybe_cache_metadata() const
209
- {
210
- if (_columns.has_value() == false) [[unlikely]]
211
- {
212
- // We expect _ttl and _columns to have the same state
213
- assert(_ttl.has_value() == false);
214
- _cache_metadata();
215
- }
216
- }
217
-
218
- public:
219
- qdb_uint_t erase_ranges(const std::string & column, py::object ranges);
220
-
221
- public:
222
- void blob_insert(const std::string & column,
223
- const pybind11::array & timestamps,
224
- const qdb::masked_array & values);
225
- void string_insert(const std::string & column,
226
- const pybind11::array & timestamps,
227
- qdb::masked_array const & values);
228
- void double_insert(const std::string & column,
229
- const pybind11::array & timestamps,
230
- qdb::masked_array const & values);
231
- void int64_insert(const std::string & column,
232
- const pybind11::array & timestamps,
233
- qdb::masked_array const & values);
234
- void timestamp_insert(const std::string & column,
235
- const pybind11::array & timestamps,
236
- const qdb::masked_array & values);
237
-
238
- public:
239
- std::pair<pybind11::array, masked_array> blob_get_ranges(
240
- const std::string & column, py::object ranges);
241
-
242
- std::pair<pybind11::array, masked_array> string_get_ranges(
243
- const std::string & column, py::object ranges);
244
-
245
- std::pair<pybind11::array, masked_array> double_get_ranges(
246
- const std::string & column, py::object ranges);
247
-
248
- std::pair<pybind11::array, masked_array> int64_get_ranges(
249
- const std::string & column, py::object ranges);
250
-
251
- std::pair<pybind11::array, masked_array> timestamp_get_ranges(
252
- const std::string & column, py::object ranges);
253
-
254
- py::object subscribe(py::object conn)
255
- {
256
- auto firehose = py::module::import("quasardb.firehose");
257
- auto xs = firehose.attr("subscribe")(conn, get_name());
258
- return xs;
259
- }
260
-
261
- private:
262
- mutable bool _has_indexed_columns;
263
- mutable detail::indexed_columns_t _indexed_columns;
264
-
265
- mutable std::optional<std::vector<detail::column_info>> _columns;
266
- mutable std::optional<std::chrono::milliseconds> _ttl;
267
- };
268
-
269
- template <typename Module>
270
- static inline void register_table(Module & m)
271
- {
272
- namespace py = pybind11;
273
-
274
- py::enum_<qdb_ts_column_type_t>{m, "ColumnType", py::arithmetic(), "Column type"} //
275
- .value("Uninitialized", qdb_ts_column_uninitialized) //
276
- .value("Double", qdb_ts_column_double) //
277
- .value("Blob", qdb_ts_column_blob) //
278
- .value("String", qdb_ts_column_string) //
279
- .value("Symbol", qdb_ts_column_symbol) //
280
- .value("Int64", qdb_ts_column_int64) //
281
- .value("Timestamp", qdb_ts_column_timestamp); //
282
-
283
- py::class_<qdb::table, qdb::entry>{m, "Table", "Table representation"} //
284
- .def(py::init<qdb::handle_ptr, std::string>()) //
285
- .def("__repr__", &qdb::table::repr) //
286
- .def("create", &qdb::table::create, py::arg("columns"), //
287
- py::arg("shard_size") = std::chrono::hours{24}, //
288
- py::arg("ttl") = std::chrono::milliseconds::zero()) //
289
- .def("get_name", &qdb::table::get_name) //
290
- .def("retrieve_metadata", &qdb::table::retrieve_metadata) //
291
- .def("column_index_by_id", &qdb::table::column_index_by_id) //
292
- .def("column_type_by_id", &qdb::table::column_type_by_id) //
293
- .def("column_info_by_index", &qdb::table::column_info_by_index) //
294
- .def("column_type_by_index", &qdb::table::column_type_by_index) //
295
- .def("column_id_by_index", &qdb::table::column_id_by_index) //
296
- .def("insert_columns", &qdb::table::insert_columns) //
297
- .def("list_columns", &qdb::table::list_columns) //
298
- .def("has_ttl", &qdb::table::has_ttl) //
299
- .def("get_ttl", &qdb::table::get_ttl) //
300
-
301
- // We cannot initialize columns with all columns by default, because i don't
302
- // see a way to figure out the `this` address for qdb_ts_reader for the default
303
- // arguments, and we need it to call qdb::table::list_columns().
304
- .def("reader", &qdb::table::reader, py::arg("columns") = std::vector<std::string>(),
305
- py::arg("ranges") = py::none{}, py::arg("dict") = false)
306
- .def("subscribe", &qdb::table::subscribe) //
307
- .def("erase_ranges", &qdb::table::erase_ranges) //
308
- .def("blob_insert", &qdb::table::blob_insert) //
309
- .def("string_insert", &qdb::table::string_insert) //
310
- .def("double_insert", &qdb::table::double_insert) //
311
- .def("int64_insert", &qdb::table::int64_insert) //
312
- .def("timestamp_insert", &qdb::table::timestamp_insert) //
313
- .def("blob_get_ranges", &qdb::table::blob_get_ranges, py::arg("column"),
314
- py::arg("ranges") = py::none{}) //
315
- .def("string_get_ranges", &qdb::table::string_get_ranges, py::arg("column"),
316
- py::arg("ranges") = py::none{}) //
317
- .def("double_get_ranges", &qdb::table::double_get_ranges, py::arg("column"),
318
- py::arg("ranges") = py::none{}) //
319
- .def("int64_get_ranges", &qdb::table::int64_get_ranges, py::arg("column"),
320
- py::arg("ranges") = py::none{}) //
321
- .def("timestamp_get_ranges", &qdb::table::timestamp_get_ranges, py::arg("column"),
322
- py::arg("ranges") = py::none{}); //
323
- }
324
-
325
- } // namespace qdb
quasardb/table_reader.hpp DELETED
@@ -1,220 +0,0 @@
1
- /*
2
- *
3
- * Official Python API
4
- *
5
- * Copyright (c) 2009-2024, quasardb SAS. All rights reserved.
6
- * All rights reserved.
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions are met:
10
- *
11
- * * Redistributions of source code must retain the above copyright
12
- * notice, this list of conditions and the following disclaimer.
13
- * * Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- * * Neither the name of quasardb nor the names of its contributors may
17
- * be used to endorse or promote products derived from this software
18
- * without specific prior written permission.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
21
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
24
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- */
31
- #pragma once
32
-
33
- #include "numpy.hpp"
34
- #include <qdb/ts.h>
35
- #include "detail/ts_column.hpp"
36
- #include "reader/ts_row.hpp"
37
- #include <pybind11/numpy.h>
38
- #include <pybind11/stl_bind.h>
39
-
40
- namespace py = pybind11;
41
-
42
- namespace qdb
43
- {
44
-
45
- using ts_columns_t = std::vector<detail::column_info>;
46
-
47
- template <typename RowType>
48
- class table_reader_iterator;
49
-
50
- template <typename RowType>
51
- bool operator==(
52
- const table_reader_iterator<RowType> & lhs, const table_reader_iterator<RowType> & rhs) noexcept;
53
-
54
- template <typename RowType>
55
- class table_reader_iterator
56
- {
57
- public:
58
- using value_type = RowType;
59
- using reference = const value_type &;
60
-
61
- friend bool operator==<RowType>(
62
- const table_reader_iterator<RowType> &, const table_reader_iterator<RowType> &) noexcept;
63
-
64
- public:
65
- table_reader_iterator()
66
- : _handle{nullptr}
67
- , _local_table{nullptr}
68
- , _the_row{_handle, _local_table, _columns}
69
- {}
70
-
71
- table_reader_iterator(handle_ptr h, qdb_local_table_t local_table, const ts_columns_t & columns)
72
- : _handle{h}
73
- , _local_table{local_table}
74
- , _columns{columns}
75
- , _the_row{_handle, _local_table, _columns}
76
- {
77
- // Immediately try to move to the first row
78
- ++(*this);
79
- }
80
-
81
- bool operator!=(const table_reader_iterator & rhs) const noexcept
82
- {
83
- return !(*this == rhs);
84
- }
85
-
86
- reference operator*() const noexcept
87
- {
88
- return _the_row;
89
- }
90
-
91
- table_reader_iterator & operator++()
92
- {
93
- _handle->check_open();
94
-
95
- qdb_error_t err = qdb_ts_table_next_row(_local_table, &_the_row.mutable_timestamp());
96
-
97
- if (err == qdb_e_iterator_end)
98
- {
99
- // As seen in the default constructor and operator==, an empty _local_table
100
- // designates an end-iterator.
101
- _local_table = nullptr;
102
- }
103
- else
104
- {
105
- qdb::qdb_throw_if_error(*_handle, err);
106
- }
107
-
108
- return *this;
109
- }
110
-
111
- private:
112
- handle_ptr _handle;
113
- qdb_local_table_t _local_table;
114
- ts_columns_t _columns;
115
- value_type _the_row;
116
- };
117
-
118
- template <typename RowType>
119
- bool operator==(
120
- const table_reader_iterator<RowType> & lhs, const table_reader_iterator<RowType> & rhs) noexcept
121
- {
122
- // Our .end() iterator is recognized by a null local table, and we'll
123
- // ignore the actual row object.
124
- if (lhs._local_table == nullptr || rhs._local_table == nullptr)
125
- {
126
- return lhs._local_table == rhs._local_table;
127
- }
128
- else
129
- {
130
- return lhs._local_table == rhs._local_table && lhs._the_row == rhs._the_row;
131
- }
132
- }
133
-
134
- template <typename RowType>
135
- class table_reader
136
- {
137
- public:
138
- using iterator = table_reader_iterator<RowType>;
139
-
140
- public:
141
- table_reader(qdb::handle_ptr h,
142
- const std::string & t,
143
- const ts_columns_t & c,
144
- const std::vector<qdb_ts_range_t> & r)
145
- : _handle{h}
146
- , _columns{c}
147
- , _local_table{nullptr}
148
- {
149
- _handle->check_open();
150
-
151
- auto c_columns = convert_columns(c);
152
-
153
- qdb::qdb_throw_if_error(*_handle, qdb_ts_local_table_init(*_handle, t.c_str(), c_columns.data(),
154
- c_columns.size(), &_local_table));
155
-
156
- qdb::qdb_throw_if_error(*_handle, qdb_ts_table_stream_ranges(_local_table, r.data(), r.size()));
157
- }
158
-
159
- // since our reader models a stateful generator, we prevent copies
160
- table_reader(const table_reader &) = delete;
161
-
162
- // since our reader models a stateful generator, we prevent moves
163
- table_reader(table_reader && rhs)
164
- : _handle(rhs._handle)
165
- , _columns(rhs._columns)
166
- , _local_table(rhs._local_table)
167
- {
168
- rhs._handle = nullptr;
169
- rhs._local_table = nullptr;
170
- rhs._columns.clear();
171
- }
172
-
173
- ~table_reader()
174
- {
175
- if (_handle && _local_table)
176
- {
177
- qdb_release(*_handle, _local_table);
178
- _local_table = nullptr;
179
- }
180
- }
181
-
182
- constexpr iterator begin() const
183
- {
184
- return iterator(_handle, _local_table, _columns);
185
- }
186
-
187
- constexpr iterator end() const
188
- {
189
- return iterator();
190
- }
191
-
192
- private:
193
- qdb::handle_ptr _handle;
194
- ts_columns_t _columns;
195
- qdb_local_table_t _local_table;
196
- };
197
-
198
- template <typename Module>
199
- static inline void register_table_reader(Module & m)
200
- {
201
- py::class_<qdb::table_reader<reader::ts_fast_row>>{m, "TimeSeriesFastReader"}
202
- .def(py::init<qdb::handle_ptr, const std::string &, const ts_columns_t &,
203
- const std::vector<qdb_ts_range_t> &>())
204
-
205
- .def(
206
- "__iter__",
207
- [](table_reader<reader::ts_fast_row> & r) { return py::make_iterator(r.begin(), r.end()); },
208
- py::keep_alive<0, 1>());
209
-
210
- py::class_<qdb::table_reader<reader::ts_dict_row>>{m, "TimeSeriesDictReader"}
211
- .def(py::init<qdb::handle_ptr, const std::string &, const ts_columns_t &,
212
- const std::vector<qdb_ts_range_t> &>())
213
-
214
- .def(
215
- "__iter__",
216
- [](table_reader<reader::ts_dict_row> & r) { return py::make_iterator(r.begin(), r.end()); },
217
- py::keep_alive<0, 1>());
218
- }
219
-
220
- } // namespace qdb
quasardb/tag.hpp DELETED
@@ -1,77 +0,0 @@
1
- /*
2
- *
3
- * Official Python API
4
- *
5
- * Copyright (c) 2009-2024, quasardb SAS. All rights reserved.
6
- * All rights reserved.
7
- *
8
- * Redistribution and use in source and binary forms, with or without
9
- * modification, are permitted provided that the following conditions are met:
10
- *
11
- * * Redistributions of source code must retain the above copyright
12
- * notice, this list of conditions and the following disclaimer.
13
- * * Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- * * Neither the name of quasardb nor the names of its contributors may
17
- * be used to endorse or promote products derived from this software
18
- * without specific prior written permission.
19
- *
20
- * THIS SOFTWARE IS PROVIDED BY QUASARDB AND CONTRIBUTORS ``AS IS'' AND ANY
21
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
24
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- */
31
- #pragma once
32
-
33
- #include "entry.hpp"
34
-
35
- namespace qdb
36
- {
37
-
38
- class tag : public entry
39
- {
40
- public:
41
- tag(qdb::handle_ptr h, const std::string & alias)
42
- : entry{h, alias}
43
- {}
44
-
45
- public:
46
- std::vector<std::string> get_entries()
47
- {
48
- const char ** aliases = nullptr;
49
- size_t count = 0;
50
-
51
- qdb::qdb_throw_if_error(*_handle, qdb_get_tagged(*_handle, _alias.c_str(), &aliases, &count));
52
-
53
- return convert_strings_and_release(_handle, aliases, count);
54
- }
55
-
56
- qdb_uint_t count()
57
- {
58
- qdb_uint_t count = 0;
59
-
60
- qdb::qdb_throw_if_error(*_handle, qdb_get_tagged_count(*_handle, _alias.c_str(), &count));
61
-
62
- return count;
63
- }
64
- };
65
-
66
- template <typename Module>
67
- static inline void register_tag(Module & m)
68
- {
69
- namespace py = pybind11;
70
-
71
- py::class_<qdb::tag, qdb::entry>(m, "Tag") //
72
- .def(py::init<qdb::handle_ptr, std::string>()) //
73
- .def("get_entries", &qdb::tag::get_entries) //
74
- .def("count", &qdb::tag::count); //
75
- }
76
-
77
- } // namespace qdb