Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions duckdb/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
These files will allow you to work along with the [Introducing DuckDB](https://realpython.com/introducing-duckdb/) tutorial.
These files will allow you to work along with the [Introducing DuckDB](https://realpython.com/python-duckdb/) tutorial.

The files are:

Code Download.ipynb - Contains the code you see in the tutorial.
parties.json - JSON file containing political party information.
presidents.csv - CSV file containing president information.
presidents.parquet - Parquet file containing president information.
- `duckdb_code.ipynb`: Contains the code you see in the tutorial.
- `parties.json`: JSON file containing political party information.
- `presidents.csv`: CSV file containing president information.
- `presidents.parquet`: Parquet file containing president information.

20 changes: 12 additions & 8 deletions duckdb/Code Download.ipynb → duckdb/duckdb_code.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@
"source": [
"**This code won't work.**\n",
"\n",
"```python\n",
"with duckdb.connect(database=\"presidents.db\") as conn:\n",
" conn.sql(\"SELECT * FROM presidents_relation\")\n"
" conn.sql(\"SELECT * FROM presidents_relation\")\n",
"```"
]
},
{
Expand Down Expand Up @@ -343,10 +345,10 @@
" print(\n",
" conn.sql(\n",
" \"\"\"\n",
" SELECT last_name, first_name\n",
" FROM presidents\n",
" WHERE sequence = 1\n",
" \"\"\"\n",
" SELECT last_name, first_name\n",
" FROM presidents\n",
" WHERE sequence = 1\n",
" \"\"\"\n",
" )\n",
" )"
]
Expand Down Expand Up @@ -391,7 +393,9 @@
"source": [
"**Only run this code if you need to update your existing `short_name()` function**\n",
"\n",
"duckdb.remove_function(\"short_name\")"
"```python\n",
"duckdb.remove_function(\"short_name\")\n",
"```"
]
},
{
Expand Down Expand Up @@ -450,15 +454,15 @@
"import duckdb\n",
"\n",
"with duckdb.connect(\"presidents.db\") as conn:\n",
" pandas_df = conn.sql(\n",
" pandas_presidents = conn.sql(\n",
" \"\"\"\n",
" SELECT last_name, first_name\n",
" FROM presidents\n",
" WHERE sequence BETWEEN 2 AND 5\n",
" \"\"\"\n",
" ).df()\n",
"\n",
"pandas_df"
"pandas_presidents"
]
},
{
Expand Down