Getting Started with DuckDB
Learn the basics of DuckDB and how to get started with this powerful analytical database.
Installation
To get started with DuckDB, you can install it using your preferred package manager:
# Using pip
pip install duckdb
# Using conda
conda install -c conda-forge duckdb
Basic Usage
Here’s a simple example of how to use DuckDB:
import duckdb
# Create a connection
con = duckdb.connect('database.db')
# Create a table
con.execute("""
CREATE TABLE users AS
SELECT * FROM read_csv_auto('users.csv')
""")
# Query the data
result = con.execute("""
SELECT * FROM users
WHERE age > 18
""").fetchall()
Key Features
- Embedded Database: Runs directly in your application
- SQL Support: Full SQL support with modern features
- Fast Performance: Optimized for analytical queries
- Multiple Language Support: Works with Python, R, and more
Next Steps
- Read the official documentation
- Join the DuckDB community
- Try out some example queries
- Build your first project