Skip to content

Instantly share code, notes, and snippets.

View kevpie's full-sized avatar

Kevin Pierce kevpie

View GitHub Profile
@kevpie
kevpie / duckdb_bq_storage_api.py
Created September 27, 2024 06:42 — forked from ML-engineer/duckdb_bq_storage_api.py
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()