Skip to content

Instantly share code, notes, and snippets.

"""Minimal reproducer: passing a DataFrame as a query parameter crashes Kuzu.
Expected: UNWIND should accept a DataFrame parameter and iterate over its rows,
or at minimum raise a clean RuntimeError.
Actual: KU_UNREACHABLE assertion failure in Kuzu internals.
"""
import kuzu
import pandas as pd
"""Reproduce Kuzu LOAD FROM timestamp null-preservation failure.
When a DataFrame column contains a mix of non-null TIMESTAMP values and
None/NaT, Kuzu's `LOAD FROM $df MERGE ... SET` silently converts the null
sentinel to a non-null timestamp (epoch) before `SET` evaluates.
The only workaround that preserves NULL is to pass timestamps as ISO-8601
strings and let `CAST(string AS TIMESTAMP)` handle the conversion: the scanner
sees strings and passes None as NULL, which `CAST` preserves.
"""
"""Reproduce Kuzu data loss for MAP(STRING, JSON) after CHECKPOINT.
Issue: https://github.com/kuzudb/kuzu/issues/6030
Reported against v0.11.2: after CHECKPOINT on a file-based database, the keys
of a MAP(STRING, JSON) column are lost and replaced with empty strings.
In-memory databases are unaffected.
This script creates a file database in a temporary directory, follows the
exact reproduction steps from the issue, and verifies whether keys are
@mdbenito
mdbenito / debug_list_struct_json.py
Last active September 18, 2025 13:27
kuzu STRUCT(...)[] bug
import itertools
import logging
import shutil
import tempfile
from pathlib import Path
import kuzu
logging.basicConfig(format="%(message)s", level=logging.DEBUG)
logger = logging.getLogger(__name__)
@mdbenito
mdbenito / batched.py
Created September 17, 2023 15:49
Batched iterators
from typing import Type, Callable, Iterable, List, TypeVar, Generator, cast
import pytest
T = TypeVar('T')
def class_wraps(original_cls: Type) -> Callable[[Type], Type]:
""" A decorator to update the wrapped class's docstring with that of the
original class (plus that of the wrapped class).
@mdbenito
mdbenito / float-api-v3-openapi.yaml
Last active April 22, 2022 09:18
An (incomplete) OpenApi spec for float.com's v3 API
openapi: 3.0.0
info:
version: '3.0'
title: Float API
description: This API allows 3rd party integration of your Float data.
security:
- bearerAuth: []
paths:
/accounts: