-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
263 changed files
with
13,123 additions
and
42,853 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: ce5fba2f0a92a5930da0c32a7521c873 | ||
config: 26a91ed028764d5136772b4feb4ec915 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file added
BIN
+57.4 KB
_images/21a007b367ec469e30a7dc54492a7e7b5f29b6150c5c2ad4e719c09784df60d5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+54.7 KB
_images/8c50ebb52c31cf313bdfa12374bce8a6162717c6d9d42aa3ded8d92da9026224.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+24.1 KB
_images/a193494302e336ea760d0f533b7653eda8f3eddacddac1c1566be8025a20e2e8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32.2 KB
_images/b207d979629c9d0869fb4711c2919aa3e8cb789efcfe170bfbdc3120e15acc8f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Introduction\n", | ||
"\n", | ||
"## Spatial databases\n", | ||
"\n", | ||
"A database management system (DBMS) allows users to store, insert, delete, and update information in a database. Spatial databases go a step further because they record data with geographic coordinates.\n", | ||
"\n", | ||
"From Esri Geodatabase to PostGIS, spatial databases have quickly become the primary method of managing spatial data.\n", | ||
"\n", | ||
"To learn more about spatial databases, check out the resources below:\n", | ||
"\n", | ||
"- [Wikipedia: Spatial database](https://en.wikipedia.org/wiki/Spatial_database)\n", | ||
"- [7 Spatial Databases for Your Enterprise](https://engage.safe.com/blog/2021/11/7-spatial-databases-enterprise)\n", | ||
"- [GISGeography: Spatial Databases – Build Your Spatial Data Empire](https://gisgeography.com/spatial-databases/)\n", | ||
"- [Esri: What is a geodatabase?](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/what-is-a-geodatabase-.htm)\n", | ||
"- [Introduction to PostGIS](https://postgis.net/workshops/postgis-intro)\n", | ||
"- [PostGEESE? Introducing The DuckDB Spatial Extension](https://duckdb.org/2023/04/28/spatial.html)\n", | ||
"\n", | ||
"## DuckDB\n", | ||
"\n", | ||
"[DuckDB](https://duckdb.org) is an in-process SQL OLAP database management system. It is designed to be used as an embedded database in applications, but it can also be used as a standalone SQL database.\n", | ||
"\n", | ||
"* _In-process SQL_ means that DuckDB’s features run in your application, not an external process to which your application connects. In other words: there is no client sending instructions nor a server to read and process them. SQLite works the same way, while PostgreSQL, MySQL…, do not.\n", | ||
"* _OLAP_ stands for OnLine Analytical Processing, and Microsoft defines it as a technology that organizes large business databases and supports complex analysis. It can be used to perform complex analytical queries without negatively affecting transactional systems. \n", | ||
"\n", | ||
"DuckDB is a great option if you’re looking for a serverless data analytics database management system. \n", | ||
"\n", | ||
"![](https://i.imgur.com/BEDGstx.png)\n", | ||
"\n", | ||
"![](https://i.imgur.com/mFpqp5I.png)\n", | ||
"\n", | ||
"To me, DuckDB feels like the [fresh air](https://tenor.com/view/breeze-nicolas-cage-con-air-smile-gif-14443307) in the database space. It is a modern database that is built from the ground up to be fast, lightweight, and easy to use. It is also open source and free to use. It has a [spatial extension](https://duckdb.org/docs/extensions/spatial.html) that allows you to perform spatial queries and analysis.\n", | ||
"\n", | ||
"## Installation\n", | ||
"\n", | ||
"### Command line\n", | ||
"\n", | ||
"Go to <https://duckdb.org/#quickinstall> and click the link under the **Command Line** section that corresponds to your operating system. Save the file to your computer and unzip it. You should now have a `duckdb` executable file. It is recommended that you move this file to a directory that is in your `PATH` environment variable.\n", | ||
"\n", | ||
"For Windows users, it is recommended that you move the `duckdb` executable file to the `C:\\Windows` directory. If you do not have permission to move the file to this directory, you can create a new directory under your user directory and add it to your `PATH` environment variable by following the instructions below:\n", | ||
"\n", | ||
"1. Open the Start Menu and search for \"environment variables\"\n", | ||
"2. Click on \"Edit the system environment variables\"\n", | ||
"3. Click on \"Environment Variables...\"\n", | ||
"4. Under \"System variables\", select the \"Path\" variable and click \"Edit...\"\n", | ||
"5. Click \"New\" and enter the path to the directory where you saved the `duckdb` executable file\n", | ||
"6. Click \"OK\" to save your changes\n", | ||
"\n", | ||
"### Python\n", | ||
"\n", | ||
"To install the required Python package for this course, it is recommended that you create a new conda environment and install the package using the following command:\n", | ||
"\n", | ||
"```bash\n", | ||
"conda create -n geo python=3.11\n", | ||
"conda activate geo\n", | ||
"conda install -c conda-forge mamba\n", | ||
"mamba install -c conda-forge python-duckdb duckdb-engine jupysql leafmap\n", | ||
"```\n", | ||
"\n", | ||
"You can also install the packages using `pip`:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"%pip install duckdb duckdb-engine jupysql leafmap" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"To test if the installation was successful, open a new terminal and run the following command:\n", | ||
"\n", | ||
"```bash\n", | ||
"conda activate geo\n", | ||
"python -c \"import duckdb; print(duckdb.__version__)\"\n", | ||
"```\n", | ||
"\n", | ||
"If the installation was successful, you should see the version number of the DuckDB package printed to the terminal. Otherwise, you will see an error message. If you see an error message, please check the installation instructions above and try again.\n", | ||
"\n", | ||
"## Setting up VS Code\n", | ||
"\n", | ||
"To make it easier to run DuckDB commands and SQL queries, it is recommended that you create a keyboard shortcut to run selected text in VS Code. To do this, open VS Code and press `Ctrl+Shift+P` to open the Command Palette. Then, search for \"Preferences: Open Keyboard Shortcuts (JSON)\" and press `Enter`. This will open the `keybindings.json` file. Add the following keyboard binding within the square brackets:\n", | ||
"\n", | ||
"```json\n", | ||
" {\n", | ||
" \"key\": \"shift+ctrl+enter\",\n", | ||
" \"command\": \"workbench.action.terminal.runSelectedText\",\n", | ||
" }\n", | ||
"```\n", | ||
"\n", | ||
"Click the Terminal tab at the bottom of the VS Code window and run the following command:\n", | ||
"\n", | ||
"```bash\n", | ||
"duckdb\n", | ||
"```\n", | ||
"\n", | ||
"To test if the keyboard shortcut is working, create a new file with the `.sql` extension within VS Code. Then, copy and paste the following SQL query into the file:\n", | ||
"\n", | ||
"```sql\n", | ||
"SELECT * FROM duckdb_extensions();\n", | ||
"```\n", | ||
"\n", | ||
"Select the text and press `Shift+Ctrl+Enter`. If the keyboard shortcut is working, you should see the following output in the terminal:\n", | ||
"\n", | ||
"![](https://i.imgur.com/5mGW8hj.png)\n", | ||
"\n", | ||
"To stop the DuckDB process, press `Ctrl+C` in the terminal. To exit the terminal, press `Ctrl+D`.\n", | ||
"\n", | ||
"### DBeaver SQL IDE\n", | ||
"\n", | ||
"[DBeaver](https://dbeaver.io) is a powerful and popular desktop sql editor and integrated development environment (IDE). It has both an open source and enterprise version. It is useful for visually inspecting the available tables in DuckDB and for quickly building complex queries. To install DBeaver, go to <https://dbeaver.io/download> and download the Community Edition for your operating system. Once installed, follow the instructions [here](https://duckdb.org/docs/guides/sql_editors/dbeaver.html) to connect to DuckDB. You can then run SQL queries in DBeaver and view the results in a table format.\n", | ||
"\n", | ||
"![](https://i.imgur.com/59clo36.png)\n", | ||
"\n", | ||
"## References\n", | ||
"\n", | ||
"- [Forget about SQLite, Use DuckDB Instead — And Thank Me Later](https://towardsdatascience.com/forget-about-sqlite-use-duckdb-instead-and-thank-me-later-df76ee9bb777)\n", | ||
"- [DuckDB: The indispensable geospatial tool you didn’t know you were missing](https://medium.com/radiant-earth-insights/duckdb-the-indispensable-geospatial-tool-you-didnt-know-you-were-missing-5fe11c5633e5)\n", | ||
"- [DuckDB's Spatial Extension](https://tech.marksblogg.com/duckdb-gis-spatial-extension.html)\n", | ||
"- [DuckDB Tutorial for Beginners](https://motherduck.com/blog/duckdb-tutorial-for-beginners/)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"language_info": { | ||
"name": "python" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.