import duckdb def insert(full_response, message): age = 28 db_path = "./workspace/sample.duckdb" con = duckdb.connect(database=db_path) con.execute( """ CREATE SEQUENCE IF NOT EXISTS sample_id_seq START 1; CREATE TABLE IF NOT EXISTS samples ( id INTEGER DEFAULT nextval('sample_id_seq'), name VARCHAR, age INTEGER, PRIMARY KEY(id) ); """ ) cur = con.cursor() con.execute("INSERT INTO samples (name, age) VALUES (?, ?)", (full_response, age)) con.execute("INSERT INTO samples (name, age) VALUES (?, ?)", (message, age)) con.execute("COPY samples TO 'sample.csv' (FORMAT CSV, HEADER)") con.commit() cur = con.execute("SELECT * FROM samples") res = cur.fetchall() rows = "" rows = "\n".join([f"name: {row[0]}, age: {row[1]}" for row in res]) con.close() return rows