quasardb 3.14.2.dev1__cp37-cp37m-win_amd64.whl → 3.14.2.dev3__cp37-cp37m-win_amd64.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 (59) hide show
  1. quasardb/CMakeLists.txt +19 -12
  2. quasardb/INSTALL.vcxproj +4 -0
  3. quasardb/__init__.py +33 -4
  4. quasardb/cluster.cpp +14 -1
  5. quasardb/cluster.hpp +114 -72
  6. quasardb/concepts.hpp +56 -12
  7. quasardb/continuous.cpp +84 -34
  8. quasardb/continuous.hpp +10 -7
  9. quasardb/convert/array.hpp +23 -6
  10. quasardb/convert/value.hpp +78 -7
  11. quasardb/date/ALL_BUILD.vcxproj +4 -4
  12. quasardb/date/CMakeFiles/Export/df49adab93b9e0c10c64f72458b31971/dateTargets.cmake +12 -12
  13. quasardb/date/CMakeFiles/generate.stamp.depend +4 -4
  14. quasardb/date/INSTALL.vcxproj +4 -0
  15. quasardb/date/dateConfigVersion.cmake +0 -5
  16. quasardb/date/dateTargets.cmake +3 -7
  17. quasardb/detail/invoke.hpp +0 -0
  18. quasardb/detail/retry.cpp +30 -0
  19. quasardb/detail/retry.hpp +147 -0
  20. quasardb/detail/sleep.hpp +53 -0
  21. quasardb/{writer.cpp → detail/writer.cpp} +68 -162
  22. quasardb/detail/writer.hpp +550 -0
  23. quasardb/error.hpp +76 -1
  24. quasardb/masked_array.hpp +9 -2
  25. quasardb/module.cpp +20 -4
  26. quasardb/node.hpp +17 -8
  27. quasardb/numpy/__init__.py +58 -10
  28. quasardb/object_tracker.hpp +2 -3
  29. quasardb/options.hpp +32 -3
  30. quasardb/pandas/__init__.py +59 -102
  31. quasardb/properties.cpp +41 -0
  32. quasardb/properties.hpp +85 -0
  33. quasardb/pybind11/ALL_BUILD.vcxproj +4 -4
  34. quasardb/pybind11/CMakeFiles/generate.stamp.depend +14 -14
  35. quasardb/pybind11/INSTALL.vcxproj +4 -0
  36. quasardb/qdb_api.dll +0 -0
  37. quasardb/quasardb.cp37-win_amd64.pyd +0 -0
  38. quasardb/range-v3/ALL_BUILD.vcxproj +4 -4
  39. quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +12 -12
  40. quasardb/range-v3/CMakeFiles/generate.stamp.depend +11 -11
  41. quasardb/range-v3/INSTALL.vcxproj +4 -0
  42. quasardb/range-v3/cmake_install.cmake +36 -0
  43. quasardb/range-v3/range-v3-config-version.cmake +0 -5
  44. quasardb/range-v3/range-v3-config.cmake +3 -7
  45. quasardb/range-v3/range.v3.headers.vcxproj +4 -4
  46. quasardb/reader.cpp +282 -0
  47. quasardb/reader.hpp +256 -0
  48. quasardb/table.cpp +4 -36
  49. quasardb/table.hpp +69 -28
  50. quasardb/traits.hpp +23 -0
  51. quasardb/writer.hpp +245 -287
  52. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev3.dist-info}/METADATA +6 -6
  53. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev3.dist-info}/RECORD +56 -50
  54. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev3.dist-info}/WHEEL +1 -1
  55. quasardb/reader/ts_row.hpp +0 -281
  56. quasardb/reader/ts_value.hpp +0 -245
  57. quasardb/table_reader.hpp +0 -220
  58. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev3.dist-info}/LICENSE.md +0 -0
  59. {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev3.dist-info}/top_level.txt +0 -0
@@ -1,245 +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 "../logger.hpp"
34
- #include "../numpy.hpp"
35
- #include <qdb/ts.h>
36
- #include <pybind11/numpy.h>
37
- #include <pybind11/stl_bind.h>
38
-
39
- namespace py = pybind11;
40
-
41
- namespace qdb
42
- {
43
- namespace reader
44
- {
45
-
46
- /**
47
- * Our value class points to a specific index in a local table, and provides
48
- * the necessary conversion functions. It does not hold any value of itself.
49
- */
50
- class ts_value
51
- {
52
- public:
53
- ts_value() noexcept
54
- : _logger("quasardb.reader.ts_value")
55
- , _local_table{nullptr}
56
- , _index{-1}
57
- , _type{qdb_ts_column_uninitialized}
58
- {}
59
-
60
- ts_value(handle_ptr handle,
61
- qdb_local_table_t local_table,
62
- int64_t index,
63
- qdb_ts_column_type_t type) noexcept
64
- : _logger("quasardb.reader.ts_value")
65
- , _handle(handle)
66
- , _local_table{local_table}
67
- , _index{index}
68
- , _type{type}
69
- {}
70
-
71
- ts_value(const ts_value & rhs) noexcept
72
- : _logger("quasardb.reader.ts_value")
73
- , _handle(rhs._handle)
74
- , _local_table{rhs._local_table}
75
- , _index{rhs._index}
76
- , _type{rhs._type}
77
- {}
78
-
79
- ts_value(ts_value && rhs) noexcept
80
- : _logger("quasardb.reader.ts_value")
81
- , _handle(rhs._handle)
82
- , _local_table{rhs._local_table}
83
- , _index{rhs._index}
84
- , _type{rhs._type} {};
85
-
86
- /**
87
- * Coerce this value to a Python value, used by the automatic type caster
88
- * defined at the bottom.
89
- */
90
- py::handle cast() const
91
- {
92
- switch (_type)
93
- {
94
- case qdb_ts_column_uninitialized:
95
- break;
96
-
97
- case qdb_ts_column_double:
98
- return double_();
99
- case qdb_ts_column_blob:
100
- return blob();
101
- case qdb_ts_column_symbol: //! *FALLTHROUGH*
102
- case qdb_ts_column_string:
103
- return string();
104
- case qdb_ts_column_int64:
105
- return int64();
106
- case qdb_ts_column_timestamp:
107
- return timestamp();
108
- };
109
-
110
- throw std::runtime_error(
111
- "Unable to cast QuasarDB type to Python type, unrecognized type: " + std::to_string(_type));
112
- }
113
-
114
- private:
115
- py::handle int64() const
116
- {
117
- std::int64_t v;
118
-
119
- auto res = qdb_ts_row_get_int64(_local_table, _index, &v);
120
- if (res == qdb_e_element_not_found)
121
- {
122
- Py_RETURN_NONE;
123
- // notreached
124
- }
125
-
126
- qdb::qdb_throw_if_error(*_handle, res);
127
-
128
- return PyLong_FromLongLong(v);
129
- }
130
-
131
- py::handle blob() const
132
- {
133
- qdb::release_guard<const void *> v(_handle);
134
- qdb_size_t l = 0;
135
-
136
- auto res = qdb_ts_row_get_blob(_local_table, _index, v.ptr(), &l);
137
- if (res == qdb_e_element_not_found)
138
- {
139
- Py_RETURN_NONE;
140
- // notreached
141
- }
142
-
143
- qdb::qdb_throw_if_error(*_handle, res);
144
- return PyByteArray_FromStringAndSize(
145
- static_cast<const char *>(v.get()), static_cast<Py_ssize_t>(l));
146
- }
147
-
148
- py::handle string() const
149
- {
150
- qdb::release_guard<const char *> v(_handle);
151
- qdb_size_t l = 0;
152
-
153
- auto res = qdb_ts_row_get_string(_local_table, _index, v.ptr(), &l);
154
- if (res == qdb_e_element_not_found)
155
- {
156
- Py_RETURN_NONE;
157
- // notreached
158
- }
159
-
160
- qdb::qdb_throw_if_error(*_handle, res);
161
- return PyUnicode_FromStringAndSize(v.get(), static_cast<Py_ssize_t>(l));
162
- }
163
-
164
- py::handle double_() const
165
- {
166
- double v = 0.0;
167
- auto res = qdb_ts_row_get_double(_local_table, _index, &v);
168
- if (res == qdb_e_element_not_found)
169
- {
170
- Py_RETURN_NONE;
171
- // notreached
172
- }
173
-
174
- qdb::qdb_throw_if_error(*_handle, res);
175
- return PyFloat_FromDouble(v);
176
- }
177
-
178
- py::handle timestamp() const
179
- {
180
- qdb_timespec_t v;
181
- auto res = qdb_ts_row_get_timestamp(_local_table, _index, &v);
182
- if (res == qdb_e_element_not_found)
183
- {
184
- Py_RETURN_NONE;
185
- // notreached
186
- }
187
-
188
- qdb::qdb_throw_if_error(*_handle, res);
189
- return qdb::numpy::datetime64(v);
190
- }
191
-
192
- private:
193
- qdb::logger _logger;
194
- handle_ptr _handle;
195
- qdb_local_table_t _local_table;
196
- int64_t _index;
197
- qdb_ts_column_type_t _type;
198
- };
199
-
200
- template <typename Module>
201
- static inline void register_ts_value(Module & m)
202
- {
203
- py::class_<ts_value>{m, "TimeSeriesReaderValue"};
204
- }
205
-
206
- } // namespace reader
207
- } // namespace qdb
208
-
209
- namespace pybind11
210
- {
211
- namespace detail
212
- {
213
-
214
- /**
215
- * Implements custom type caster for our ts_value class, so that conversion
216
- * to and from native python types is completely transparent.
217
- */
218
- template <>
219
- struct type_caster<qdb::reader::ts_value>
220
- {
221
- public:
222
- /**
223
- * Note that this macro magically sets a member variable called 'value'.
224
- */
225
- PYBIND11_TYPE_CASTER(qdb::reader::ts_value, _("qdb::reader::ts_value"));
226
-
227
- /**
228
- * We do not support Python->C++
229
- */
230
- bool load(handle src, bool) const noexcept
231
- {
232
- return false;
233
- }
234
-
235
- /**
236
- * C++->Python
237
- */
238
- static handle cast(qdb::reader::ts_value src, return_value_policy /* policy */, handle /* parent */)
239
- {
240
- return src.cast();
241
- }
242
- };
243
-
244
- } // namespace detail
245
- } // namespace pybind11
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