Skip to content

Commit ba44320

Browse files
committed
--wip-- [skip ci]
1 parent b7a8893 commit ba44320

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ asyncio_default_fixture_loop_scope = "function"
4343

4444
[dependency-groups]
4545
dev = [
46+
"geopandas>=1.0.1",
4647
"maturin>=1.7.4",
4748
"mypy>=1.11.2",
4849
"pyarrow>=19.0.1",

src/duckdb.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,48 @@ impl DuckdbClient {
6969
Ok(dict)
7070
}
7171

72+
#[pyo3(signature = (href, *, intersects=None, ids=None, collections=None, limit=None, bbox=None, datetime=None, include=None, exclude=None, sortby=None, filter=None, query=None, **kwargs))]
73+
fn search_to_arrow<'py>(
74+
&self,
75+
py: Python<'py>,
76+
href: String,
77+
intersects: Option<StringOrDict>,
78+
ids: Option<StringOrList>,
79+
collections: Option<StringOrList>,
80+
limit: Option<u64>,
81+
bbox: Option<Vec<f64>>,
82+
datetime: Option<String>,
83+
include: Option<StringOrList>,
84+
exclude: Option<StringOrList>,
85+
sortby: Option<StringOrList>,
86+
filter: Option<StringOrDict>,
87+
query: Option<Bound<'py, PyDict>>,
88+
kwargs: Option<Bound<'py, PyDict>>,
89+
) -> Result<Bound<'py, PyObject>> {
90+
let search = stac_api::python::search(
91+
intersects,
92+
ids,
93+
collections,
94+
limit,
95+
bbox,
96+
datetime,
97+
include,
98+
exclude,
99+
sortby,
100+
filter,
101+
query,
102+
kwargs,
103+
)?;
104+
let record_batches = {
105+
let client = self
106+
.0
107+
.lock()
108+
.map_err(|err| PyException::new_err(err.to_string()))?;
109+
client.search_to_arrow(&href, search)?
110+
};
111+
todo!()
112+
}
113+
72114
fn get_collections<'py>(&self, py: Python<'py>, href: String) -> Result<Bound<'py, PyList>> {
73115
let client = self
74116
.0

tests/test_duckdb.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import pytest
2+
from geopandas import GeoDataFrame
23
from stacrs import DuckdbClient
34

45

@@ -37,3 +38,9 @@ def test_get_collections(client: DuckdbClient) -> None:
3738

3839
def test_init_with_config() -> None:
3940
DuckdbClient(use_s3_credential_chain=True, use_hive_partitioning=True)
41+
42+
43+
def test_search_to_arrow(client: DuckdbClient) -> None:
44+
table = client.search_to_arrow("data/100-sentinel-2-items.parquet")
45+
data_frame = GeoDataFrame.from_arrow(table)
46+
assert len(data_frame) == 100

uv.lock

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

0 commit comments

Comments
 (0)