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
55 lines (47 loc) · 1.28 KB
/
Copy pathpython_conversion.hpp
File metadata and controls
55 lines (47 loc) · 1.28 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
55
//===----------------------------------------------------------------------===//
// DuckDB
//
// duckdb_python/pyresult.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "duckdb_python/numpy/array_wrapper.hpp"
#include "duckdb.hpp"
#include "duckdb_python/nb/casters.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(nb::handle &ele);
LogicalType SniffPythonIntegerType(nb::handle ele);
bool DictionaryHasMapFormat(const PyDictionary &dict);
void TransformPythonObject(optional_ptr<ClientContext> context, nb::handle ele, Vector &vector, idx_t result_offset,
bool nan_as_null = true);
Value TransformPythonValue(optional_ptr<ClientContext> context, nb::handle ele,
const LogicalType &target_type = LogicalType::UNKNOWN, bool nan_as_null = true);
} // namespace duckdb