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
-- 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 |
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
CREATE MACRO add_one(value) AS (value + 1); |
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
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 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 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 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 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 | |
# You can put this in your .bashrc or .zshrc | |
function csv_to_parquet() { | |
file_path="$1" | |
duckdb -c "COPY (SELECT * FROM read_csv_auto('$file_path')) TO '${file_path%.*}.parquet' (FORMAT PARQUET);" | |
} |
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
from pathlib import Path | |
import pytest | |
import tftest | |
from google.auth.transport.requests import AuthorizedSession | |
from .cloud_run_client import ( | |
get_auth_session, | |
get_service_account_file_path, | |
get_token_credentials_from_service_account, |
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
import json | |
import pytest | |
from google.auth.transport.requests import AuthorizedSession | |
from .cloud_run_client import request_wrapper | |
@pytest.mark.integration | |
def test_health_check(auth_session: AuthorizedSession): |
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
import pytest | |
import tftest | |
from pathlib import Path | |
@pytest.fixture | |
def plan(): | |
file_path = Path(__file__).resolve() | |
base_dir = file_path.parent.parent.parent.absolute() | |
tf = tftest.TerraformTest(tfdir="terraform", basedir=base_dir) |
NewerOlder