This file contains hidden or 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
-- Install httpfs extension | |
INSTALL httpfs; | |
LOAD httpfs; | |
-- Install Scrooge extension https://github.com/pdet/Scrooge-McDuck | |
-- NOTE : You need to start DuckDB with `-unsigned` flag to authorized to install & load 3rd party extension | |
SET custom_extension_repository='scrooge-duckdb.s3.us-west-2.amazonaws.com/scrooge/s3_deploy'; | |
INSTALL scrooge; | |
LOAD scrooge; | |
-- Example of query | |
FROM yahoo_finance("^GSPC", "2023-02-01", "2023-02-04", "1d"); |
This file contains hidden or 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
#!/bin/bash | |
# A simple script for converting files between CSV and Parquet formats using DuckDB. Requires DuckDB installation. | |
convert_file() { | |
local input_file="$1" | |
local output_extension="$2" | |
# Extracting the filename without extension | |
local base_name=$(basename -- "$input_file") | |
local name="${base_name%.*}" |
This file contains hidden or 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
#!/usr/bin/env bash | |
set -e | |
CDN="https://github.com/duckdb/duckdb/releases/download" | |
INSTALL_DIR="$HOME/.local/bin" | |
# Function to initialize platform specifics | |
initPlatform() { | |
OS=$(uname -s | tr '[:upper:]' '[:lower:]') | |
ARCH=$(uname -m) |
This file contains hidden or 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
import logging | |
from datetime import datetime | |
import functools | |
# Setting up logging | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
def measure_time(func): | |
@functools.wraps(func) |
This file contains hidden or 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
CREATE MACRO add_one(value) AS (value + 1); |
This file contains hidden or 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
-- ataching the remote database (268KB) | |
ATTACH 's3://us-prd-motherduck-open-datasets/content/duckdb-as-catalog/ducky_catalog.ddb'; | |
SHOW all tables; | |
-- queries the data | |
FROM ducky_catalog.customers limit 5; | |
-- Listing views |
OlderNewer