Summary
In this chapter, we moved beyond using the simple DuckDB CLI for working with DuckDB databases and began our journey into using DuckDB with Python. We started by getting our environment set up with the necessary dependencies. We then looked at the two different ways to connect to DuckDB from Python: using the default in-memory database, which is convenient for performing interactive data analysis and other types of ad-hoc DuckDB usage, and the explicit use of connection objects, which offers increased flexibility within our DuckDB-powered workflows, as well as being the safer way to build Python libraries that interact with DuckDB databases. We then saw how we can connect to disk-based DuckDB databases, allowing us to persist prepared databases for subsequent use, before coving the importance of closing database connections, especially when using disk-based databases. We also looked at the more specialized use case of multiple processes connecting to a disk-based database in...