From eaa04ae170e57b1688bd10936a19fcb91f3409e0 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 10 Feb 2025 17:27:29 +0200 Subject: Use tempdir in example.py --- py_bindings/example.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'py_bindings') diff --git a/py_bindings/example.py b/py_bindings/example.py index 4abbd1d..d002a8a 100644 --- a/py_bindings/example.py +++ b/py_bindings/example.py @@ -1,6 +1,6 @@ +import tempfile from pprint import pformat, pprint -import log_db -from log_db import Value, Type, Bound +from log_db import Value, Type, Bound, DB # TODO: This should be imported from the log_db module # but exporting type aliases does not work automatically @@ -27,10 +27,12 @@ class Inst: def __repr__(self) -> str: return pformat(self.__dict__) +temp_dir = tempfile.TemporaryDirectory() + # Create a new database -db = log_db.DB \ +db = DB \ .configure() \ - .data_dir("db") \ + .data_dir(temp_dir.name) \ .schema([ ("id", Type.int()), ("name", Type.string()), -- cgit v1.3