quasardb 3.14.2.dev1__cp311-cp311-macosx_11_0_arm64.whl → 3.14.2.dev2__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.
- quasardb/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/CMakeLists.txt +19 -12
- quasardb/Makefile +10 -10
- quasardb/__init__.py +33 -4
- quasardb/cluster.cpp +7 -1
- quasardb/cluster.hpp +111 -72
- quasardb/concepts.hpp +56 -12
- quasardb/continuous.cpp +84 -34
- quasardb/continuous.hpp +10 -7
- quasardb/convert/array.hpp +23 -6
- quasardb/convert/value.hpp +78 -7
- quasardb/date/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/date/CMakeFiles/Export/a52b05f964b070ee926bcad51d3288af/dateTargets.cmake +12 -12
- quasardb/date/Makefile +10 -10
- quasardb/date/dateConfigVersion.cmake +9 -2
- quasardb/date/dateTargets.cmake +3 -7
- quasardb/detail/invoke.hpp +0 -0
- quasardb/detail/retry.cpp +30 -0
- quasardb/detail/retry.hpp +147 -0
- quasardb/detail/sleep.hpp +53 -0
- quasardb/{writer.cpp → detail/writer.cpp} +68 -162
- quasardb/detail/writer.hpp +550 -0
- quasardb/error.hpp +76 -1
- quasardb/libqdb_api.dylib +0 -0
- quasardb/masked_array.hpp +9 -2
- quasardb/module.cpp +20 -4
- quasardb/numpy/__init__.py +58 -10
- quasardb/object_tracker.hpp +2 -3
- quasardb/options.hpp +32 -3
- quasardb/pandas/__init__.py +59 -102
- quasardb/properties.cpp +41 -0
- quasardb/properties.hpp +85 -0
- quasardb/pybind11/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/pybind11/Makefile +10 -10
- quasardb/quasardb.cpython-311-darwin.so +0 -0
- quasardb/range-v3/CMakeFiles/CMakeDirectoryInformation.cmake +1 -1
- quasardb/range-v3/CMakeFiles/Export/d94ef200eca10a819b5858b33e808f5b/range-v3-targets.cmake +12 -12
- quasardb/range-v3/CMakeFiles/range.v3.headers.dir/DependInfo.cmake +6 -2
- quasardb/range-v3/CMakeFiles/range.v3.headers.dir/build.make +2 -2
- quasardb/range-v3/Makefile +10 -10
- quasardb/range-v3/cmake_install.cmake +12 -0
- quasardb/range-v3/range-v3-config-version.cmake +9 -2
- quasardb/range-v3/range-v3-config.cmake +3 -7
- quasardb/reader.cpp +282 -0
- quasardb/reader.hpp +256 -0
- quasardb/table.cpp +4 -36
- quasardb/table.hpp +69 -28
- quasardb/traits.hpp +23 -0
- quasardb/writer.hpp +245 -287
- {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev2.dist-info}/METADATA +7 -7
- {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev2.dist-info}/RECORD +54 -48
- {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev2.dist-info}/WHEEL +1 -1
- quasardb/reader/ts_row.hpp +0 -281
- quasardb/reader/ts_value.hpp +0 -245
- quasardb/table_reader.hpp +0 -220
- {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev2.dist-info}/LICENSE.md +0 -0
- {quasardb-3.14.2.dev1.dist-info → quasardb-3.14.2.dev2.dist-info}/top_level.txt +0 -0
quasardb/reader.hpp
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/*
|
|
2
|
+
*
|
|
3
|
+
* Official Python API
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2009-2021, 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 "handle.hpp"
|
|
34
|
+
#include "logger.hpp"
|
|
35
|
+
#include "object_tracker.hpp"
|
|
36
|
+
#include <qdb/ts.h>
|
|
37
|
+
#include <unordered_map>
|
|
38
|
+
#include <vector>
|
|
39
|
+
|
|
40
|
+
namespace py = pybind11;
|
|
41
|
+
|
|
42
|
+
namespace qdb
|
|
43
|
+
{
|
|
44
|
+
|
|
45
|
+
namespace detail
|
|
46
|
+
{
|
|
47
|
+
|
|
48
|
+
using int64_column = std::vector<qdb_int_t>;
|
|
49
|
+
using double_column = std::vector<double>;
|
|
50
|
+
using timestamp_column = std::vector<qdb_timespec_t>;
|
|
51
|
+
using blob_column = std::vector<qdb_blob_t>;
|
|
52
|
+
using string_column = std::vector<qdb_string_t>;
|
|
53
|
+
|
|
54
|
+
class reader_data
|
|
55
|
+
{
|
|
56
|
+
public:
|
|
57
|
+
/**
|
|
58
|
+
* Utility function which converts table data into a vanilla dict. Currently this works well, as
|
|
59
|
+
* there isn't any additional data/state we need to keep track of --
|
|
60
|
+
*/
|
|
61
|
+
static py::dict convert(qdb_bulk_reader_table_data_t const & data);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
class reader_iterator
|
|
65
|
+
{
|
|
66
|
+
public:
|
|
67
|
+
// Default constructor, which represents the "end" of the range
|
|
68
|
+
reader_iterator() noexcept
|
|
69
|
+
: handle_{nullptr}
|
|
70
|
+
, reader_{nullptr}
|
|
71
|
+
, batch_size_{0}
|
|
72
|
+
, table_count_{0}
|
|
73
|
+
, ptr_{nullptr}
|
|
74
|
+
, n_{0}
|
|
75
|
+
{}
|
|
76
|
+
|
|
77
|
+
// Actual initialization
|
|
78
|
+
reader_iterator(
|
|
79
|
+
handle_ptr handle, qdb_reader_handle_t reader, std::size_t batch_size, std::size_t table_count)
|
|
80
|
+
: handle_{handle}
|
|
81
|
+
, reader_{reader}
|
|
82
|
+
, batch_size_{batch_size}
|
|
83
|
+
, table_count_{table_count}
|
|
84
|
+
|
|
85
|
+
, ptr_{nullptr}
|
|
86
|
+
, n_{0}
|
|
87
|
+
{
|
|
88
|
+
// Always immediately try to fetch the first batch.
|
|
89
|
+
this->operator++();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
bool operator!=(reader_iterator const & rhs) const noexcept
|
|
93
|
+
{
|
|
94
|
+
return !(*this == rhs);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
bool operator==(reader_iterator const & rhs) const noexcept
|
|
98
|
+
{
|
|
99
|
+
// This is just a sanity check: if our handle_ is null, it means basically
|
|
100
|
+
// the entire object has to be null, and this will basically represent the
|
|
101
|
+
// ".end()" iterator.
|
|
102
|
+
|
|
103
|
+
if (handle_ == nullptr)
|
|
104
|
+
{
|
|
105
|
+
assert(reader_ == nullptr);
|
|
106
|
+
assert(ptr_ == nullptr);
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
{
|
|
110
|
+
assert(reader_ != nullptr);
|
|
111
|
+
assert(ptr_ != nullptr);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Optimization: we *only* compare the pointers, we don't actually compare
|
|
115
|
+
// the data itself. This saves a bazillion comparisons, and for the purpose
|
|
116
|
+
// of iterators, we really only care whether the current iterator is at the
|
|
117
|
+
// end.
|
|
118
|
+
return (handle_ == rhs.handle_ //
|
|
119
|
+
&& reader_ == rhs.reader_ //
|
|
120
|
+
&& batch_size_ == rhs.batch_size_ //
|
|
121
|
+
&& table_count_ == rhs.table_count_ //
|
|
122
|
+
&& ptr_ == rhs.ptr_ && n_ == rhs.n_);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
reader_iterator & operator++();
|
|
126
|
+
|
|
127
|
+
py::dict operator*()
|
|
128
|
+
{
|
|
129
|
+
assert(ptr_ != nullptr);
|
|
130
|
+
assert(n_ < table_count_);
|
|
131
|
+
|
|
132
|
+
return reader_data::convert(ptr_[n_]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
private:
|
|
136
|
+
qdb::handle_ptr handle_;
|
|
137
|
+
qdb_reader_handle_t reader_;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The amount of rows to fetch in one operation. This can span multiple tables.
|
|
141
|
+
*/
|
|
142
|
+
std::size_t batch_size_;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* `table_count_` enables us to manage how much far we can iterate `ptr_`.
|
|
146
|
+
*/
|
|
147
|
+
std::size_t table_count_;
|
|
148
|
+
qdb_bulk_reader_table_data_t * ptr_;
|
|
149
|
+
std::size_t n_;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
}; // namespace detail
|
|
153
|
+
|
|
154
|
+
class reader
|
|
155
|
+
{
|
|
156
|
+
public:
|
|
157
|
+
using iterator = detail::reader_iterator;
|
|
158
|
+
|
|
159
|
+
public:
|
|
160
|
+
/**
|
|
161
|
+
* Tables must always be a list of actual table objects. This ensures the lifetime
|
|
162
|
+
* of any metadata inside the tables (such as its name) will always exceed that
|
|
163
|
+
* of the reader, which simplifies things a lot.
|
|
164
|
+
*/
|
|
165
|
+
reader( //
|
|
166
|
+
qdb::handle_ptr handle, //
|
|
167
|
+
std::vector<std::string> const & table_names, //
|
|
168
|
+
std::vector<std::string> const & column_names, //
|
|
169
|
+
std::size_t batch_size, //
|
|
170
|
+
std::vector<py::tuple> const & ranges) //
|
|
171
|
+
: logger_("quasardb.reader")
|
|
172
|
+
, handle_{handle}
|
|
173
|
+
, reader_{nullptr}
|
|
174
|
+
, table_names_{table_names}
|
|
175
|
+
, column_names_{column_names}
|
|
176
|
+
, batch_size_{batch_size}
|
|
177
|
+
, ranges_{ranges}
|
|
178
|
+
{}
|
|
179
|
+
|
|
180
|
+
// prevent copy because of the table object, use a unique_ptr of the batch in cluster
|
|
181
|
+
// to return the object.
|
|
182
|
+
//
|
|
183
|
+
// we prevent these copies because that is almost never what you want, and it gives us
|
|
184
|
+
// more freedom in storing a lot of data inside this object.
|
|
185
|
+
reader(const reader &) = delete;
|
|
186
|
+
reader(reader &&) = delete;
|
|
187
|
+
|
|
188
|
+
~reader()
|
|
189
|
+
{
|
|
190
|
+
close();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Convenience function for accessing the configured batch size. Returns 0 when everything should
|
|
195
|
+
* be read in a single batch.
|
|
196
|
+
*/
|
|
197
|
+
constexpr inline std::size_t get_batch_size() const noexcept
|
|
198
|
+
{
|
|
199
|
+
return batch_size_;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Opens the actual reader; this will initiatate a call to quasardb and initialize the local
|
|
204
|
+
* reader handle. If table strings are provided instead of qdb::table objects, will automatically
|
|
205
|
+
* look those up.
|
|
206
|
+
*
|
|
207
|
+
* May throw exception upon error.
|
|
208
|
+
*
|
|
209
|
+
* :NOTE(leon): We just return a reference to ourselves, but maybe we want the outer object to wrap
|
|
210
|
+
* a subclass and return that as well. Not 100% sure if that's the best way to go. This
|
|
211
|
+
* works right now and is the same approach that we take with e.g. qdb::cluster
|
|
212
|
+
*/
|
|
213
|
+
reader const & enter();
|
|
214
|
+
|
|
215
|
+
void exit(pybind11::object type, pybind11::object value, pybind11::object traceback)
|
|
216
|
+
{
|
|
217
|
+
return close();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Clean up and close. Does not require all data to be actually read.
|
|
222
|
+
*/
|
|
223
|
+
void close();
|
|
224
|
+
|
|
225
|
+
iterator begin() const
|
|
226
|
+
{
|
|
227
|
+
if (reader_ == nullptr) [[unlikely]]
|
|
228
|
+
{
|
|
229
|
+
throw qdb::uninitialized_exception{
|
|
230
|
+
"Reader not yet opened: please encapsulate calls to the reader in a `with` block, or "
|
|
231
|
+
"explicitly `open` and `close` the resource"};
|
|
232
|
+
}
|
|
233
|
+
return iterator{handle_, reader_, batch_size_, table_names_.size()};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
iterator end() const noexcept
|
|
237
|
+
{
|
|
238
|
+
return iterator{};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private:
|
|
242
|
+
qdb::logger logger_;
|
|
243
|
+
qdb::handle_ptr handle_;
|
|
244
|
+
qdb_reader_handle_t reader_;
|
|
245
|
+
|
|
246
|
+
std::vector<std::string> table_names_;
|
|
247
|
+
std::vector<std::string> column_names_;
|
|
248
|
+
std::size_t batch_size_;
|
|
249
|
+
std::vector<py::tuple> ranges_;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
using reader_ptr = std::unique_ptr<reader>;
|
|
253
|
+
|
|
254
|
+
void register_reader(py::module_ & m);
|
|
255
|
+
|
|
256
|
+
} // namespace qdb
|
quasardb/table.cpp
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
#include "dispatch.hpp"
|
|
3
3
|
#include "metrics.hpp"
|
|
4
4
|
#include "object_tracker.hpp"
|
|
5
|
-
#include "
|
|
5
|
+
#include "reader.hpp"
|
|
6
6
|
#include "traits.hpp"
|
|
7
7
|
#include "convert/point.hpp"
|
|
8
|
+
#include <memory> // for make_unique
|
|
8
9
|
|
|
9
10
|
namespace qdb
|
|
10
11
|
{
|
|
@@ -100,42 +101,8 @@ void table::_cache_metadata() const
|
|
|
100
101
|
{
|
|
101
102
|
_ttl = std::chrono::milliseconds{metadata->ttl};
|
|
102
103
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
py::object table::reader(
|
|
106
|
-
const std::vector<std::string> & columns, py::object ranges, bool dict_mode) const
|
|
107
|
-
{
|
|
108
|
-
_handle->check_open();
|
|
109
|
-
|
|
110
|
-
auto ranges_ = qdb::convert_ranges(ranges);
|
|
111
|
-
|
|
112
|
-
std::vector<detail::column_info> c_columns;
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
{
|
|
116
|
-
// This is a kludge, because technically a table can have no columns, and we're
|
|
117
|
-
// abusing it as "no argument provided". It's a highly exceptional use case, and
|
|
118
|
-
// doesn't really have any implication in practice (we just look up twice), so it
|
|
119
|
-
// should be ok.
|
|
120
|
-
c_columns = list_columns();
|
|
121
|
-
}
|
|
122
|
-
else
|
|
123
|
-
{
|
|
124
|
-
c_columns.reserve(columns.size());
|
|
125
|
-
// This transformation can probably be optimized, but it's only invoked when constructing
|
|
126
|
-
// the reader so it's unlikely to be a performance bottleneck.
|
|
127
|
-
std::transform(std::cbegin(columns), std::cend(columns), std::back_inserter(c_columns),
|
|
128
|
-
[this](const auto & col) {
|
|
129
|
-
const auto & info = column_info_by_id(col);
|
|
130
|
-
return detail::column_info{info.type, col, info.symtable};
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return (dict_mode == true
|
|
135
|
-
? py::cast(qdb::table_reader<reader::ts_dict_row>(_handle, _alias, c_columns, ranges_),
|
|
136
|
-
py::return_value_policy::move)
|
|
137
|
-
: py::cast(qdb::table_reader<reader::ts_fast_row>(_handle, _alias, c_columns, ranges_),
|
|
138
|
-
py::return_value_policy::move));
|
|
105
|
+
_shard_size = std::chrono::milliseconds{metadata->shard_size};
|
|
139
106
|
}
|
|
140
107
|
|
|
141
108
|
qdb_uint_t table::erase_ranges(const std::string & column, py::object ranges)
|
|
@@ -286,4 +253,5 @@ std::pair<pybind11::array, masked_array> table::timestamp_get_ranges(
|
|
|
286
253
|
|
|
287
254
|
return ret;
|
|
288
255
|
}
|
|
256
|
+
|
|
289
257
|
}; // namespace qdb
|
quasardb/table.hpp
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
#include "entry.hpp"
|
|
34
34
|
#include "masked_array.hpp"
|
|
35
|
+
#include "reader.hpp"
|
|
35
36
|
#include "detail/ts_column.hpp"
|
|
36
37
|
|
|
37
38
|
namespace qdb
|
|
@@ -87,7 +88,7 @@ public:
|
|
|
87
88
|
qdb_ts_insert_columns_ex(*_handle, _alias.c_str(), c_columns.data(), c_columns.size()));
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
std::vector<detail::column_info> list_columns() const
|
|
91
|
+
std::vector<detail::column_info> const & list_columns() const
|
|
91
92
|
{
|
|
92
93
|
if (_columns.has_value()) [[likely]]
|
|
93
94
|
{
|
|
@@ -156,8 +157,14 @@ public:
|
|
|
156
157
|
return column_info_by_id(alias).type;
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
qdb::reader_ptr reader( //
|
|
161
|
+
std::vector<std::string> const & column_names, //
|
|
162
|
+
std::size_t batch_size, //
|
|
163
|
+
std::vector<py::tuple> const & ranges) const //
|
|
164
|
+
{
|
|
165
|
+
std::vector<std::string> table_names{get_name()};
|
|
166
|
+
return std::make_unique<qdb::reader>(_handle, table_names, column_names, batch_size, ranges);
|
|
167
|
+
};
|
|
161
168
|
|
|
162
169
|
/**
|
|
163
170
|
* Returns true if this table has a TTL assigned.
|
|
@@ -196,6 +203,23 @@ public:
|
|
|
196
203
|
throw qdb::alias_not_found_exception{};
|
|
197
204
|
}
|
|
198
205
|
|
|
206
|
+
inline std::chrono::milliseconds get_shard_size() const
|
|
207
|
+
{
|
|
208
|
+
if (_shard_size.has_value()) [[likely]]
|
|
209
|
+
{
|
|
210
|
+
return _shard_size.value();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
_cache_metadata();
|
|
214
|
+
|
|
215
|
+
if (_shard_size.has_value()) [[likely]]
|
|
216
|
+
{
|
|
217
|
+
return _shard_size.value();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
throw qdb::alias_not_found_exception{};
|
|
221
|
+
}
|
|
222
|
+
|
|
199
223
|
private:
|
|
200
224
|
/**
|
|
201
225
|
* Loads column info / metadata from server and caches it locally.
|
|
@@ -209,8 +233,9 @@ private:
|
|
|
209
233
|
{
|
|
210
234
|
if (_columns.has_value() == false) [[unlikely]]
|
|
211
235
|
{
|
|
212
|
-
// We expect _ttl and _columns to have the same state
|
|
236
|
+
// We expect _ttl and _columns and _shard_size (i.e. all metadata) to have the same state
|
|
213
237
|
assert(_ttl.has_value() == false);
|
|
238
|
+
assert(_shard_size.has_value() == false);
|
|
214
239
|
_cache_metadata();
|
|
215
240
|
}
|
|
216
241
|
}
|
|
@@ -264,6 +289,7 @@ private:
|
|
|
264
289
|
|
|
265
290
|
mutable std::optional<std::vector<detail::column_info>> _columns;
|
|
266
291
|
mutable std::optional<std::chrono::milliseconds> _ttl;
|
|
292
|
+
mutable std::optional<std::chrono::milliseconds> _shard_size;
|
|
267
293
|
};
|
|
268
294
|
|
|
269
295
|
template <typename Module>
|
|
@@ -285,7 +311,8 @@ static inline void register_table(Module & m)
|
|
|
285
311
|
.def("__repr__", &qdb::table::repr) //
|
|
286
312
|
.def("create", &qdb::table::create, py::arg("columns"), //
|
|
287
313
|
py::arg("shard_size") = std::chrono::hours{24}, //
|
|
288
|
-
py::arg("ttl") = std::chrono::milliseconds::zero()
|
|
314
|
+
py::arg("ttl") = std::chrono::milliseconds::zero() //
|
|
315
|
+
) //
|
|
289
316
|
.def("get_name", &qdb::table::get_name) //
|
|
290
317
|
.def("retrieve_metadata", &qdb::table::retrieve_metadata) //
|
|
291
318
|
.def("column_index_by_id", &qdb::table::column_index_by_id) //
|
|
@@ -297,29 +324,43 @@ static inline void register_table(Module & m)
|
|
|
297
324
|
.def("list_columns", &qdb::table::list_columns) //
|
|
298
325
|
.def("has_ttl", &qdb::table::has_ttl) //
|
|
299
326
|
.def("get_ttl", &qdb::table::get_ttl) //
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
//
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
py::arg("
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
.def("
|
|
310
|
-
.def("
|
|
311
|
-
.def("
|
|
312
|
-
.def("
|
|
313
|
-
.def("
|
|
314
|
-
|
|
315
|
-
.def("
|
|
316
|
-
|
|
317
|
-
.def("
|
|
318
|
-
py::arg("
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
.def("
|
|
322
|
-
py::arg("
|
|
327
|
+
.def("get_shard_size", &qdb::table::get_shard_size) //
|
|
328
|
+
//
|
|
329
|
+
.def("reader", &qdb::table::reader, //
|
|
330
|
+
py::kw_only(), //
|
|
331
|
+
py::arg("column_names") = std::vector<std::string>{}, //
|
|
332
|
+
py::arg("batch_size") = std::size_t{0}, //
|
|
333
|
+
py::arg("ranges") = std::vector<py::tuple>{} //
|
|
334
|
+
) //
|
|
335
|
+
//
|
|
336
|
+
.def("subscribe", &qdb::table::subscribe) //
|
|
337
|
+
.def("erase_ranges", &qdb::table::erase_ranges) //
|
|
338
|
+
.def("blob_insert", &qdb::table::blob_insert) //
|
|
339
|
+
.def("string_insert", &qdb::table::string_insert) //
|
|
340
|
+
.def("double_insert", &qdb::table::double_insert) //
|
|
341
|
+
.def("int64_insert", &qdb::table::int64_insert) //
|
|
342
|
+
.def("timestamp_insert", &qdb::table::timestamp_insert) //
|
|
343
|
+
//
|
|
344
|
+
.def("blob_get_ranges", &qdb::table::blob_get_ranges, //
|
|
345
|
+
py::arg("column"), //
|
|
346
|
+
py::arg("ranges") = py::none{} //
|
|
347
|
+
) //
|
|
348
|
+
.def("string_get_ranges", &qdb::table::string_get_ranges, //
|
|
349
|
+
py::arg("column"), //
|
|
350
|
+
py::arg("ranges") = py::none{} //
|
|
351
|
+
) //
|
|
352
|
+
.def("double_get_ranges", &qdb::table::double_get_ranges, //
|
|
353
|
+
py::arg("column"), //
|
|
354
|
+
py::arg("ranges") = py::none{} //
|
|
355
|
+
) //
|
|
356
|
+
.def("int64_get_ranges", &qdb::table::int64_get_ranges, //
|
|
357
|
+
py::arg("column"), //
|
|
358
|
+
py::arg("ranges") = py::none{} //
|
|
359
|
+
) //
|
|
360
|
+
.def("timestamp_get_ranges", &qdb::table::timestamp_get_ranges, //
|
|
361
|
+
py::arg("column"), //
|
|
362
|
+
py::arg("ranges") = py::none{} //
|
|
363
|
+
); //
|
|
323
364
|
}
|
|
324
365
|
|
|
325
366
|
} // namespace qdb
|
quasardb/traits.hpp
CHANGED
|
@@ -218,6 +218,21 @@ VALUE_TRAIT_DECL(qdb_blob_t)
|
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
220
|
|
|
221
|
+
VALUE_TRAIT_DECL(char const *)
|
|
222
|
+
{
|
|
223
|
+
static constexpr bool is_qdb_primitive = false;
|
|
224
|
+
|
|
225
|
+
static constexpr char const * null_value() noexcept
|
|
226
|
+
{
|
|
227
|
+
return nullptr;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
static constexpr bool is_null(char const * x) noexcept
|
|
231
|
+
{
|
|
232
|
+
return x == null_value();
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
221
236
|
VALUE_TRAIT_DECL(qdb_ts_double_point)
|
|
222
237
|
{
|
|
223
238
|
using primitive_type = double;
|
|
@@ -616,4 +631,12 @@ inline typename T::value_type null_value() noexcept
|
|
|
616
631
|
return T::null_value();
|
|
617
632
|
};
|
|
618
633
|
|
|
634
|
+
template <class T>
|
|
635
|
+
struct is_chrono_duration : std::false_type
|
|
636
|
+
{};
|
|
637
|
+
|
|
638
|
+
template <class Rep, class Period>
|
|
639
|
+
struct is_chrono_duration<std::chrono::duration<Rep, Period>> : std::true_type
|
|
640
|
+
{};
|
|
641
|
+
|
|
619
642
|
}; // namespace qdb::traits
|