forked from duckdb/duckdb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_conversion.hpp
More file actions
54 lines (46 loc) · 1.19 KB
/
python_conversion.hpp
File metadata and controls
54 lines (46 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb_python/pyresult.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb_python/numpy/array_wrapper.hpp"
#include "duckdb.hpp"
#include "duckdb_python/pybind11/pybind_wrapper.hpp"
#include "duckdb_python/python_objects.hpp"
#include "duckdb/common/types.hpp"
#include "duckdb/common/types/hugeint.hpp"
#include "datetime.h" // from Python
namespace duckdb {
enum class PythonObjectType {
Other,
None,
Integer,
Float,
Bool,
Decimal,
Uuid,
Datetime,
Date,
Time,
Timedelta,
String,
ByteArray,
MemoryView,
Bytes,
List,
Tuple,
Dict,
NdArray,
NdDatetime,
Value
};
PythonObjectType GetPythonObjectType(py::handle &ele);
LogicalType SniffPythonIntegerType(py::handle ele);
bool DictionaryHasMapFormat(const PyDictionary &dict);
void TransformPythonObject(py::handle ele, Vector &vector, idx_t result_offset, bool nan_as_null = true);
Value TransformPythonValue(py::handle ele, const LogicalType &target_type = LogicalType::UNKNOWN,
bool nan_as_null = true);
} // namespace duckdb