forked from duckdb/duckdb-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimporter.cpp
More file actions
24 lines (21 loc) · 777 Bytes
/
Copy pathimporter.cpp
File metadata and controls
24 lines (21 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "duckdb_python/import_cache/importer.hpp"
#include "duckdb_python/import_cache/python_import_cache.hpp"
#include "duckdb_python/import_cache/python_import_cache_item.hpp"
#include "duckdb_python/pyconnection/pyconnection.hpp"
namespace duckdb {
nb::handle PythonImporter::Import(stack<reference<PythonImportCacheItem>> &hierarchy, bool load) {
auto &import_cache = *DuckDBPyConnection::ImportCache();
nb::handle source(nullptr);
while (!hierarchy.empty()) {
// From top to bottom, import them
auto &item = hierarchy.top();
hierarchy.pop();
source = item.get().Load(import_cache, source, load);
if (!source) {
// If load is false, or the module load fails and is not required, we return early
break;
}
}
return source;
}
} // namespace duckdb