Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ RUN apt-get update && apt-get install -y build-essential libpq-dev && rm -rf /va
COPY pyproject.toml poetry.lock ./
RUN VIRTUAL_ENV=/venv poetry install --no-root --no-directory --all-extras --without dev

ARG DUCKDB_EXTENSION_REPO=https://syncandshare.desy.de/public.php/dav/files/PPGeSD8ceELYbiw

# pre-install duckdb extensions
RUN echo "import duckdb\nfor ext in ['httpfs', 'iceberg', 'avro']: duckdb.install_extension(ext); duckdb.load_extension(ext)" | /venv/bin/python
RUN echo "import duckdb\nfor ext in ['httpfs', 'avro']: duckdb.install_extension(ext); duckdb.load_extension(ext)" | /venv/bin/python
RUN echo "import duckdb; duckdb.connect(config={'allow_unsigned_extensions': 'true'}).install_extension('iceberg', repository_url='$DUCKDB_EXTENSION_REPO');" | /venv/bin/python

COPY ampel ampel
COPY README.md README.md
Expand Down
2 changes: 1 addition & 1 deletion ampel/lsst/archive/server/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async def list_nights(
):
return flatten(
alerts.aggregate(
[ # type: ignore[arg-type]
[
SQLExpression("diaSource.visit // 100000 as night").alias("night"),
SQLExpression("count(*) as alerts"),
SQLExpression("count(distinct diaSource.visit) as visits"),
Expand Down
4 changes: 2 additions & 2 deletions ampel/lsst/archive/server/iceberg.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

@cache
def get_duckdb() -> DuckDBPyConnection:
conn = connect()
for ext in "httpfs", "iceberg":
conn = connect(config={"allow_unsigned_extensions": "true"})
for ext in "httpfs", "avro", "iceberg":
conn.load_extension(ext)
conn.execute(f"""
CREATE OR REPLACE SECRET secret (
Expand Down
82 changes: 38 additions & 44 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ dependencies = [
"hishel (>=1.1.9,<2.0.0)",
"httpx (>=0.28.1,<0.29.0)",
"prometheus-fastapi-instrumentator (>=7.1.0,<8.0.0)",
"duckdb (>=1.4.4,<2.0.0)",
# exactly same version as in duckdb-iceberg submodule
"duckdb (==1.5.0.dev293)",
"orjson (>=3.11.7,<4.0.0)"
]

Expand Down
10 changes: 9 additions & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ def _alert_table(catalog, warehouse_dir: Path):
p.mkdir() # "On some systems, mode is ignored"
p.chmod(0o777)

cursor = duckdb.connect()
cursor = duckdb.connect(config={"allow_unsigned_extensions": "true"})
for ext in "httpfs", "avro":
cursor.install_extension(ext)
cursor.load_extension(ext)
cursor.install_extension(
"iceberg",
repository_url="https://syncandshare.desy.de/public.php/dav/files/PPGeSD8ceELYbiw",
)
cursor.load_extension("iceberg")
cursor.execute(f"""
ATTACH 'warehouse' AS iceberg_catalog(
TYPE iceberg, AUTHORIZATION_TYPE none,
Expand Down