From 42f0b254f18edcab12c96de95e772d57c4d64d27 Mon Sep 17 00:00:00 2001 From: Mathis Chenuet <9201969+artemisart@users.noreply.github.com> Date: Mon, 5 Feb 2024 02:36:53 +0100 Subject: [PATCH] doctest sqlite test --- functional/pipeline.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functional/pipeline.py b/functional/pipeline.py index 5627712..9766a61 100644 --- a/functional/pipeline.py +++ b/functional/pipeline.py @@ -1715,9 +1715,10 @@ def to_sqlite3( The table schema is inferred from the elements in the sequence if only target table name is supplied. + >>> conn = sqlite3.connect(':memory:') + >>> _ = conn.execute('CREATE TABLE user (id int, name text)') >>> seq([(1, 'Tom'), (2, 'Jack')])\ - .to_sqlite3('examples/users.db', 'INSERT INTO user (id, name) VALUES (?, ?)') - + .to_sqlite3(conn, 'INSERT INTO user (id, name) VALUES (?, ?)') >>> seq([{'id': 1, 'name': 'Tom'}, {'id': 2, 'name': 'Jack'}]).to_sqlite3(conn, 'user') :param conn: path or sqlite connection, cursor