Altering tables and creating views
Up to now, our data wrangling process has involved loading our web log data into a DuckDB table that stores log records as unstructured lines, followed by a reshaping step that builds a new structured table, with useful fields extracted as columns. In this section, we will cover the remaining two steps required to prepare the dataset for the analysis we want to perform: data type conversion and data enrichment. The first of these will ensure that each column has the appropriate data type for its contents, and the second will ensure that our columns are readily interpretable.
As we cover the remaining data preparation steps, we’ll also look at different strategies for persisting these transformations. The first way involves applying stateful changes to an existing table. The second way involves using virtual tables, called views, to wrap up multiple transformations into a single convenient abstraction.
Converting strings to dates
Let...