aboutsummaryrefslogtreecommitdiffstats
path: root/py_bindings/example.py
diff options
context:
space:
mode:
Diffstat (limited to 'py_bindings/example.py')
-rw-r--r--py_bindings/example.py10
1 files changed, 6 insertions, 4 deletions
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()),