Skip to content

Commit f0f42ed

Browse files
committed
fix: stash b/c things are broken strangely
1 parent ba44320 commit f0f42ed

File tree

5 files changed

+186
-8
lines changed

5 files changed

+186
-8
lines changed

Cargo.lock

Lines changed: 91 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ pyo3-async-runtimes = { version = "0.23.0", features = [
1616
"tokio",
1717
"tokio-runtime",
1818
] }
19+
pyo3-arrow = "0.7.2"
20+
pyo3-log = "0.12.1"
1921
pythonize = "0.23.0"
2022
serde = "1.0.217"
2123
serde_json = "1.0.138"

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ classifiers = [
2121
]
2222
keywords = ["stac", "geospatial"]
2323
dynamic = ["version"]
24+
dependencies = [
25+
"arro3-core>=0.4.5",
26+
]
2427

2528
[project.scripts]
2629
stacrs = "stacrs:main"

src/duckdb.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use pyo3::{
44
prelude::*,
55
types::{PyDict, PyList},
66
};
7+
use pyo3_arrow::PyTable;
78
use stac_api::python::{StringOrDict, StringOrList};
89
use stac_duckdb::{Client, Config};
910
use std::sync::Mutex;
@@ -86,7 +87,7 @@ impl DuckdbClient {
8687
filter: Option<StringOrDict>,
8788
query: Option<Bound<'py, PyDict>>,
8889
kwargs: Option<Bound<'py, PyDict>>,
89-
) -> Result<Bound<'py, PyObject>> {
90+
) -> Result<PyObject> {
9091
let search = stac_api::python::search(
9192
intersects,
9293
ids,
@@ -102,13 +103,23 @@ impl DuckdbClient {
102103
kwargs,
103104
)?;
104105
let record_batches = {
105-
let client = self
106+
let mut client = self
106107
.0
107108
.lock()
108109
.map_err(|err| PyException::new_err(err.to_string()))?;
109-
client.search_to_arrow(&href, search)?
110+
let convert_wkb = client.config.convert_wkb;
111+
let result = client.search_to_arrow(&href, search);
112+
client.config.convert_wkb = convert_wkb;
113+
result?
110114
};
111-
todo!()
115+
if record_batches.is_empty() {
116+
Ok(py.None())
117+
} else {
118+
let schema = record_batches[0].schema();
119+
let table = PyTable::try_new(record_batches, schema)?;
120+
let table = table.to_arro3(py)?;
121+
Ok(table)
122+
}
112123
}
113124

114125
fn get_collections<'py>(&self, py: Python<'py>, href: String) -> Result<Bound<'py, PyList>> {

0 commit comments

Comments
 (0)