Here's my thought on Python API - DuckDB

To persist data in duckdb you need to first make a connection to a duck db database.

con = duckdb.connect('file.db')

Then work off of the connection con rather than duckdb.

con.sql('CREATE TABLE test(i INTEGER)')
con.sql('INSERT INTO test VALUES (42)')
# query the table
# explicitly close the connection

This post was a thought by Waylon Walker see all my thoughts at